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

Need minAttributes and maxAttributes in the swagger:model annotation #2985

Open
seanhoughton opened this issue Nov 8, 2023 · 1 comment
Open
Labels
enhancement generate spec Related to spec generation from code scanner

Comments

@seanhoughton
Copy link

Problem statement

The spec-to-code transformation supports the minProperties and maxProperties constraints but the code-to-spec transformation does not. This means that users who use both transformations cannot take advantage of the fix to untyped maps without manually adding the constraints in the generated swagger spec.

Model specification

// swagger:model MyObjectType
// minAttributes: 0  <--- would like to see support for this
type MyObjectType map[string]interface{}

I spent some time in the code trying to figure out how to do this, but it would be more productive if someone can give me some pointers - I'm happy to work on a PR.

Great project!

@fredbi fredbi added the generate spec Related to spec generation from code label Dec 10, 2023
@fredbi
Copy link
Contributor

fredbi commented Jan 2, 2024

Yes good proposal. minProperties, maxProperties are more in line with jsonschema validations, though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement generate spec Related to spec generation from code scanner
Projects
None yet
Development

No branches or pull requests

2 participants