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

Need help with using $refs #192

Open
123survesh opened this issue Dec 9, 2022 · 1 comment
Open

Need help with using $refs #192

123survesh opened this issue Dec 9, 2022 · 1 comment

Comments

@123survesh
Copy link

123survesh commented Dec 9, 2022

My current directory structure:

| spec
      | main.yaml
      | template.yaml
      | organisation
          | organisation.yaml

I am trying to import a schema written in template.yaml to organisation.yaml. organisation.yaml contains operations for a path and it will again be added via refs to main.yaml to a path.

I am facing an issue when trying to reference a schema template.yaml in organisation.yaml.

organisation.yaml

get:
    summary: Fetch an organisation's data
    responses:
      "200":
        description: ok
        content:
          application/json:
            schema:
              type: object
              properties:
                gkstatus:
                  $ref: "../template.yaml#/components/schemas/gkstatus"
  1. When I try ../template.yaml, it searches in the parent directory of spec
  2. When I try ../spec/template.yaml, it searches in /spec/spec/template.yaml
  3. I got it working by having a copy of template.yaml inside the organisation folder and one inside the spec folder near the main.yaml file

I am confused, can some one help me out?

@zupo
Copy link
Collaborator

zupo commented Dec 9, 2022

I've never personally used multiple yaml files, so can't help you with this one, sorry :(

That said, I'm very interested in having a working example of this included in https://github.com/Pylons/pyramid_openapi3/tree/main/examples, could you submit a Pull Request to add it once you've figured it out?

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

No branches or pull requests

2 participants