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

Add support for the attributes in struct fields #239

Merged
merged 1 commit into from
Nov 6, 2018

Conversation

nkly
Copy link
Contributor

@nkly nkly commented Nov 5, 2018

This commit adds support for the following attributes in the struct fields:

  • minimum, for numeric fields, via minimum:"value" struct tag
  • maximum, for numeric fields, via maximum:"value" struct tag
  • minLength, for string fields, via minLength:"value" struct tag
  • maxLength, for string fields, via maxLength:"value" struct tag
  • enums, via enums:"value1,value2,value3" struct tag
  • default, via default:"value" struct tag

All these tags except default are also supported in array fields.

@easonlin404
Copy link
Member

@nkly could you help resolve conflicting files, rest LGTM?

@nkly
Copy link
Contributor Author

nkly commented Nov 6, 2018

@easonlin404 Sure

This commit adds support for the following attributes in the struct
fields:

- "minimum": for numeric fields, via `minimum:"value"` struct tag
- "maximum": for numeric fields, via `maximum:"value"` struct tag
- "minLength": for string fields, via `minLength:"value"` struct tag
- "maxLength": for string fields, via `maxLength:"value"` struct tag
- "enums": via `enums:"value1,value2,value3"` struct tag
- "default": via `default:"value"` struct tag

All these tags except "default" are also supported in "array" fields.
@nkly nkly force-pushed the support-struct-field-attributes branch from c53c0a2 to 1095ca5 Compare November 6, 2018 08:27
Copy link
Member

@easonlin404 easonlin404 left a comment

Choose a reason for hiding this comment

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

LGTM

@easonlin404 easonlin404 merged commit 6993bc5 into swaggo:master Nov 6, 2018
@nkly nkly deleted the support-struct-field-attributes branch November 6, 2018 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants