-
-
Notifications
You must be signed in to change notification settings - Fork 93
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
Support for relative references #321
Comments
Thank you for using the The And about Open API support, it is used by the JSON-Schema implementation almost without change. |
+1, I got the same issue and it's stopping me from generating types with dtsgenerator. @skh- can you provide a more detailed explanation on how you manage to make it work with an id ? I could use it as a temporary workaround bu I can't found a working example |
Hi @skh- & @Orodan, |
Looks like $ref could be relative |
dtsgenerator creates some really great definitions. I'm having some issues with the
$ref
implementation requiring a top-levelid
.OpenAPI defines the
$ref
:using the URL of the current document as the base URI
. Setting the$ref
value to match a dtsgenerator-only-syntax matching anid:
causes trouble using this with any other OpenAPI software.The base cause is that this is not valid a OpenAPI v3 schema. IE running it through something like swagger-parser will fail validation.
Consider this structure:
Assume that:
Api.yaml
has a$ref
toResponse.yaml
andAuth.yaml
Response.yaml
has a$ref
toAuth.yaml
.If I set the
id:
's andref:
's to/Auth.yaml
and/Response.yaml
, it will work with dtsgenerator.However, this will fail OpenAPI validation (
id:
property not valid, and eg./Auth.yaml
not found on disk.) and make this schema unusable with most other Open API packages.If I set the
$ref
to the follow the proper spec:Api.yaml
:./components/responses/Response.yaml
,./components/models/Auth.yaml
Response.yaml
:../models/Auth.yaml
Then it will follow the spec and work with most other packages, but fail with dtsgenerator. There is no way to match the
id:
property, sinceAuth.yaml
is referenced from two different places.I'm sure there is a good reason why
id
is required - but is there no way to use this package using the spec-defined implementation of$ref
? Or a workaround? Or am I doing something wrong?Thanks for the great work!
The text was updated successfully, but these errors were encountered: