-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
multiple openapi.yaml files show errors #7
Comments
Is your |
Hi @MikeRalphson , No it does not. But I don't think a reference file is required to have all that? Two validators (openapi-lint and swagger-cli validate) have verified that the specs are correct (reference files and all). Another example from my root.oas3.yaml is $ref for each path.
I don't think it would make sense for I'm wondering if there needs to be a distinction made between to openapi-lint on whether the spec files are to be treated individually or if there is some root file we can specify and it resolves all the references (much like I could be wrong in all of this though. Still new to all of this. Thanks, |
@MikeRalphson just saw your link now. Let me take a look, it may make my post moot. |
The article was great and highlighted something for me which was there is no right way of doing things in the spec (so my comment of valid vs invalid probably isn't right). I wasn't sure how i could maintain my file structure. So an example is as follows: root.oas3.yaml:
healthcheck.oas3.yaml:
definitions.oas3.yaml:
|
I would personally structure your files as follows: openapi: 3.0.0
info:
version: 0.0.1
title: myService
paths:
/healthcheck:
$ref: "./healthcheck.oas3.yaml#/paths/~1healthcheck"
servers:
- url: / openapi: 3.0.0
info:
title: Healthcheck fragment
version: 0.0.1
paths:
/healthcheck:
get:
description: Health check
operationId: healthcheck
x-swagger-router-controller: healthcheck
responses:
"200":
description: Service is healthy and all dependencies are up
content:
application/json:
schema:
type: array
items:
type: string
default:
description: Error
content:
application/json:
schema:
$ref: "./definitions.oas3.yaml#/components/schemas/ErrorResponse" openapi: 3.0.0
info:
title: Definitions fragment
version: 0.0.1
paths: {}
components:
schemas:
ErrorResponse:
required:
- message
properties:
message:
type: "string"
description: "The description of the error"
code:
type: "string"
description: "Identifies the kind of error" The There is a tracking issue on the OAS spec. repository for making the paths object optional in OAS v3.1.0. |
Your examples highlighted a missing option being passed to the resolver, so that's now fixed in |
Glad I was able to help, but not sure how :) I'm going to try to use your model going forward. Thanks for the advice. |
No worries - please feel free to chase up this issue with any further comments. Hopefully it will be helpful to other people too. |
Hi,
I have my spec spread out across multiple *.oas3.yaml files. (e.g. root.oas3.yaml and definitions.oas3.yaml) that use the $ref.
If i "resolve and validate" the root file, I receive a notification that the file is valid.
However, if i go into definitions.oas3.yaml, I see red underlines all over the place. For example "Unexpected property ErrorResponse" among others.
How can we let the extension know that this is part of a larger file structure and not show errors when they aren't really errors.
thanks,
jas
The text was updated successfully, but these errors were encountered: