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

refs #4715 - change JsonSchemaDialect to one accepted by Swagger-UI #4729

Merged
merged 3 commits into from
Sep 10, 2024

Conversation

micryc
Copy link
Contributor

@micryc micryc commented Sep 3, 2024

refs issue #4715, related to swagger-ui openapi 3.1 support

@micryc micryc requested a review from frantuma September 3, 2024 08:42
Copy link
Member

@frantuma frantuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change to the jsonSchemaDialect is ok.

The issue of missing type in schema serialization when using openapi31 is instead more a bug in ModelResolver

Changing these lines to the following should do the trick:

            model = new ComposedSchema().name(name);
            if (openapi31) {
                model.addType("object");
            } else {
                model.type("object");
            }
        } else {
            AnnotatedType aType = ReferenceTypeUtils.unwrapReference(annotatedType);
            if (aType != null) {
                model = context.resolve(aType);
                return model;
            } else {
                model = new Schema().name(name);
                if (openapi31) {
                    model.addType("object");
                } else {
                    model.type("object");
                }

Also tests need to be added

Also to be mentioned in ticket: the openapi31 flag is the best and correct way to resolve into an OpenAPI 3.1 specification, as it understands 3.1 annotations and correctly uses 3.1 model. convertToOpenAPI31 is an early option to get out a 3.1 doc, still usable but less "powerful"

@micryc micryc merged commit 1859ee6 into master Sep 10, 2024
6 checks passed
@micryc micryc deleted the Fix-#4715-JsonSchemaDialect branch September 10, 2024 12:52
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

Successfully merging this pull request may close these issues.

2 participants