13 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
39cf847787 api: regenerate with go-swagger v0.33.1
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-11 19:59:25 +02:00
Sebastiaan van Stijn
bbdd24d145 api/templates: align with go-swagger v1.32.3
Align our custom templates with the one from upstream;
https://github.com/go-swagger/go-swagger/tree/v0.32.3/generator/templates

- Add "TODO" comments in places where we applied patches to make it
  easier to compare with upstream, and to see where differences are
  intentional.
- Update the server/operations.gotmpl template;
  - Add the "generated" header in the right place, so that it's
    recognized as generated file.
  - Add back the upstream template code; instead of removing the
    code, put a "if false" block around it; this allows comparing
    our forked templates with upstream when updating the version
    of go-swagger (to make sure we're not missing fixes).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-11 12:23:10 +02:00
Cory Snider
ea1c2530da api/t/network: generate Inspect, Summary structs
Replace the hand-rolled Network, Summary and Inspect struct types in
api/types/network with types generated from the Swagger definition.

Disable the generation of all unwanted marshalers and unmarshalers.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-04 19:46:43 -04:00
Cory Snider
c208f90796 api/templates: vendor structfield template
Taken verbatim from
eee6eaf67f/generator/templates/structfield.gotmpl
so the alterations from the upstream template can be easily diffed.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-04 15:38:14 -04:00
Cory Snider
2783f80ecf api/types: generate with latest go-swagger
Override some of the templates to suppress emitting unwanted validation
and marshal/unmarshal code.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-08-01 13:30:23 -04:00
Sebastiaan van Stijn
bf9d739561 api: remove // import comments
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.

Remove these imports in preparation of migrating our code to become an
actual go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-30 15:59:01 +02:00
Sebastiaan van Stijn
3df4f86f21 swagger: fix "generated code" comment not in correct format
As described in https://golang.org/s/generatedcode, Go has
a formalized format that should be used to indicate that a
file is generated.

Matching that format helps linters to skip generated files;

From https://golang.org/s/generatedcode (https://github.com/golang/go/issues/13560#issuecomment-288457920);

> Generated files are marked by a line of text that matches the regular expression, in Go syntax:
>
>     ^// Code generated .* DO NOT EDIT\.$
>
> The `.*` means the tool can put whatever folderol it wants in there, but the comment
> must be a single line and must start with `Code generated` and end with `DO NOT EDIT.`,
> with a period.
>
> The text may appear anywhere in the file.

This patch updates the template used for our generated types
to match that format.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-11-05 11:32:37 -08:00
Sebastiaan van Stijn
93886fcc5a Add "import" statement to generated API types
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-10 14:07:55 +02:00
Sebastiaan van Stijn
a8b4e04e2f Fix API template to not use "golang.org/x/net/context"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-07-13 09:54:24 +02:00
Nicolas De Loof
8e7f9afa47 use swagger support for « title » as generated types names for inline schema
align naming convention with x-go-name

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2017-12-13 18:54:37 +01:00
yupeng
c471b7f243 hack/swagger-gen.sh is not exist, it should be /hack/generate-swagger-api.sh
Signed-off-by: yupeng <yu.peng36@zte.com.cn>
2016-11-22 16:32:32 +08:00
Daniel Nephin
8f81bb92a3 Update to inline comments.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-10-31 11:13:41 -04:00
Daniel Nephin
d459e83b1c Generate VolumeList response from the swagger spec
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-10-31 11:13:41 -04:00