Skip to content

Dockerfile: Use upstream go-swagger#47827

Closed
vvoland wants to merge 2 commits intomoby:masterfrom
vvoland:swagger-go-upstream
Closed

Dockerfile: Use upstream go-swagger#47827
vvoland wants to merge 2 commits intomoby:masterfrom
vvoland:swagger-go-upstream

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)

vvoland added 2 commits May 13, 2024 12:23
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 <[email protected]>
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 <[email protected]>
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.

2 participants