Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doubts related to using $ref and variables #1560

Open
GagandeepSharma060 opened this issue Jan 22, 2025 · 4 comments
Open

Doubts related to using $ref and variables #1560

GagandeepSharma060 opened this issue Jan 22, 2025 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@GagandeepSharma060
Copy link

Hi Specmatic team, thanks for your great work
Had 2 doubts if you can help me get an answer

  1. Do we support using variables in the yaml files, and using these variables in multiple places in the same file (here by file i mean a spec)

  2. Can we use the $ref functionality inside the value: block of any examples. I can across some use cases when i need to send a request payload, where few keys need to be dynamic, which I need to get from some other file. If yes, can u please share an example. If no, is there ny workaround?

Thanks in advance

@GagandeepSharma060
Copy link
Author

One use case for this case can be if i want to pass currentTime in the request payload along with some other static attributes. How can we do that?

@pranavgawri pranavgawri self-assigned this Jan 23, 2025
@pranavgawri pranavgawri added the question Further information is requested label Jan 23, 2025
@samyakOO7
Copy link
Contributor

samyakOO7 commented Jan 23, 2025

Hi @GagandeepSharma060,
Thanks for reaching out. We will get back to you shortly on this.

@GagandeepSharma060
Copy link
Author

Hi @samyakOO7 Can u please share any insights on this

@harikrishnan83
Copy link
Member

hello @GagandeepSharma060 , thanks for reaching out. Can you please help me with some more details in order to answer this questions.

Do we support using variables in the yaml files, and using these variables in multiple places in the same file (here by file i mean a spec)

We do fully support $ref resolution as per OpenAPI specification. Not sure what you mean by variables in YAML file. Can you please share an example of what you man by a "variable"?

Can we use the $ref functionality inside the value: block of any examples. I can across some use cases when i need to send a request payload, where few keys need to be dynamic, which I need to get from some other file. If yes, can u please share an example. If no, is there ny workaround?

This is an interesting use case. Please give me some time to come back to you with a few options based on our upcoming release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants