Skip to content

Descriptions for types#328

Merged
deepmap-marcinr merged 16 commits intooapi-codegen:masterfrom
MarkRosemaker:descriptions-for-types
Apr 1, 2021
Merged

Descriptions for types#328
deepmap-marcinr merged 16 commits intooapi-codegen:masterfrom
MarkRosemaker:descriptions-for-types

Conversation

@MarkRosemaker
Copy link
Contributor

@MarkRosemaker MarkRosemaker commented Mar 28, 2021

This PR adds support for type descriptions.

Instead of
// Foo defines model for Foo.
it's possible to write a description in the yaml file and get
// Foo represents a test object.

@@ -1,5 +1,5 @@
{{range .Types}}
// {{.TypeName}} defines model for {{.JsonName}}.
// {{.TypeName}} {{ with .Description }}represents {{ . }}{{ else }}defines model for {{.JsonName}}{{ end }}.

Choose a reason for hiding this comment

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

If I define a description, I would find it strange to have "represents" added in a hard coded manner. What do you think about just taking the description {{.}} as is?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, I've changed it. Thanks!

@deepmap-marcinr deepmap-marcinr merged commit ef7bee4 into oapi-codegen:master Apr 1, 2021
adrianpk pushed a commit to foorester/oapi-codegen that referenced this pull request Jan 16, 2024
* add description field

* use description field in template

* fix tests

* remove last line

* Update templates.gen.go

* Update templates.gen.go

* remove hardcoded stuff

* Update typedef.tmpl

* simplify by adding description to Schema

* Update components.gen.go

* Update templates.gen.go

* Update schema.go

* fix tests

* fix tests

* Update schema.go

* fix tests
adrianpk added a commit to foorester/oapi-codegen that referenced this pull request May 31, 2024
* add description field

* use description field in template

* fix tests

* remove last line

* Update templates.gen.go

* Update templates.gen.go

* remove hardcoded stuff

* Update typedef.tmpl

* simplify by adding description to Schema

* Update components.gen.go

* Update templates.gen.go

* Update schema.go

* fix tests

* fix tests

* Update schema.go

* fix tests
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.

3 participants