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

Models: minimum: null/maximum: null for string and boolean seem redundant #15

Closed
SerVB opened this issue Mar 13, 2020 · 3 comments
Closed

Comments

@SerVB
Copy link
Contributor

SerVB commented Mar 13, 2020

In the models section, there are redundant fields:

image

Current workaround is activating mapper.setSerializationInclusion(Include.NON_NULL) for Jackson.

However, it changes the way the server answers, so it's not a solution in some cases.

I think the solution can be just to omit generating minimum and maximum for string and boolean in the models section.

This is an issue extracted from #12.

@Wicpar
Copy link
Collaborator

Wicpar commented Mar 13, 2020

made appropriate modifications in the rewoked-model branch.

implementation 'com.github.papsign:Ktor-OpenAPI-Generator:reworked-model-SNAPSHOT'
and to remove null and empty fields:

                get("/openapi.json") {
                    call.respond(application.openAPIGen.api.build())
                }

It will be merged into master when it is determined as clean and maintainable.

@Wicpar Wicpar closed this as completed Mar 13, 2020
@SerVB
Copy link
Contributor Author

SerVB commented Mar 14, 2020

Yep, this works! A small concern here that .build() is executed every time the request is performed. Maybe it's better to use a lazy property to store the built schema.

@Wicpar
Copy link
Collaborator

Wicpar commented Mar 14, 2020

It is possible, in principle, to create new routes during runtime, so the model can in principle change. This is up to the user.

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