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

Generate spec follows alias types #1087

Merged
merged 4 commits into from Jul 21, 2017
Merged

Conversation

smacker
Copy link
Contributor

@smacker smacker commented Jul 2, 2017

Aliases in swagger.json present as native types.
Therefore all validation comments work as expected for them.

type Int64 int64

type MyModel struct {
    // min: 10
    IntField Int64 `json:"intField"`
}

Also fixes #649

I use go-swagger only for json generation, please let me know if it breaks anything in code generator or anywhere else.

Aliases in swagger.json present as native types. Therefore all
validation comments work as expected for them. Also fixes go-swagger#649
@codecov
Copy link

codecov bot commented Jul 2, 2017

Codecov Report

Merging #1087 into master will increase coverage by 0.09%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1087      +/-   ##
==========================================
+ Coverage   72.18%   72.28%   +0.09%     
==========================================
  Files          21       21              
  Lines        6048     6068      +20     
==========================================
+ Hits         4366     4386      +20     
  Misses       1217     1217              
  Partials      465      465
Impacted Files Coverage Δ
scan/scanner.go 73.34% <ø> (ø) ⬆️
scan/schema.go 71.92% <100%> (+0.49%) ⬆️
scan/parameters.go 77.77% <100%> (+0.57%) ⬆️
scan/classifier.go 94.28% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2ea68fd...b70c0b4. Read the comment docs.

@smacker
Copy link
Contributor Author

smacker commented Jul 2, 2017

oops. master merged

@casualjim
Copy link
Member

Perhaps something like this should get a marker annotation and be an additional feature instead of replacing what is there now for schemas. I don't know who's depending on the existing behavior.

For query/path/form params this is different though; there it would actually be the expected behavior.

@smacker
Copy link
Contributor Author

smacker commented Jul 2, 2017

Do I understand right that it should be like:

type Int64 int64

type MyModel struct {
    // swagger:alias
    // min: 10
    IntField Int64 `json:"intField"`
}

for any struct and behavior by default for structs annotated with swagger:params?

@casualjim
Copy link
Member

Yes I think so, that gives people a way to choose

@smacker
Copy link
Contributor Author

smacker commented Jul 3, 2017

good. thanks for the clarification. I'll try to implement it later.

@casualjim casualjim merged commit 85921aa into go-swagger:master Jul 21, 2017
@smacker
Copy link
Contributor Author

smacker commented Jul 21, 2017

Thank you sir!

@casualjim
Copy link
Member

yeah sorry I lost track of it. I try to follow a merge quickly policy

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.

swagger generate spec: type aliases in query parameters
2 participants