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

Should Schema.content be SchemaJson and not JsonSchema? #502

Open
glen-84 opened this issue May 16, 2021 · 1 comment
Open

Should Schema.content be SchemaJson and not JsonSchema? #502

glen-84 opened this issue May 16, 2021 · 1 comment

Comments

@glen-84
Copy link
Contributor

glen-84 commented May 16, 2021

In this interface:

export interface Schema {
    type: SchemaType;
    openApiVersion?: 2 | 3;
    id: SchemaId;
    content: JsonSchema;
    rootSchema?: Schema;
}

... content is typed as JsonSchema, but JsonSchema does not have a components property – is it supposed to be SchemaJson?

@horiuchi
Copy link
Owner

You make a good point.

This type definition has been in use since before OpenAPI was supported, so it's outdated now.
At that time, only JSON Schema was considered, so the type of content is only JsonSchema.
Now, it would be better to use type and openApiVersion to set the content type to the correct one (JsonSchemaDraft04.Schema, JsonSchemaDraft07.Schema, OpenApisV2.SchemaJson or OpenApisV3.SchemaJson).

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