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

Dockerfile: Use upstream go-swagger #47827

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vvoland
Copy link
Contributor

@vvoland vvoland commented May 13, 2024

- What I did
Replaced an outdated fork of go-swagger (based on some version from 2016) with a recent upstream version.
The recent version fixes the lack of omitempty for the x-nullable fields (see #47526 (comment)).

However, there's one catch...

Old version did have a --skip-validator switch which turned off generation of the Validate method for the generated models. It has been removed somewhere around 2018 and is no longer available in the recent version.

While not harmful, we don't make any use of these validators, so they're only bloating our api definitions and requiring more dependencies in our api package:

	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/validate"

Restoring this option is pretty straightforward, as the generator backend already has an option for that.
See: vvoland/go-swagger@0448fe8

If we want to skip generating these, we should:

  1. Make our own fork that restores this option (we already have https://github.com/moby/go-swagger?)
  2. Check with the upstream if they would be willing to accept it

- How to verify it
CI

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

Use a recent go-swagger version instead of the outdated fork based on
swagger-go from 2016.

Remove usage of `--skip-validator` flag as it was dropped in 2018
(go-swagger PR 1353).

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Due to the `--skip-validators` no longer being supported in the upstream
swagger-go, this also adds a bunch of validation methods to the
generated types.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant