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

go: bump github.com/deepmap/oapi-codegen from 1.9.0 to 1.11.0 #101

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Jun 28, 2022

Bumps github.com/deepmap/oapi-codegen from 1.9.0 to 1.11.0.

Release notes

Sourced from github.com/deepmap/oapi-codegen's releases.

Many updates, you will need to update your configuration

Many changes to code generation

We've had many big changes which affect code generation on the back burner, for fear of breaking code dependent on previous behavior, but this was holding back many fixes, so this release, in its default behavior, breaks generated code to be incompatible with existing code. However, we've been able to provide configuration options to disable this new behavior in all cases. So, with small changes to how oapi-codegen is invoked, you can continue to generate compatible code, however, you will not have these new changes, all of which fix bugs.

Configuration and flag changes

First, we are moving from flag based configuration of the tool, to using a configuration file. The configuration file is directly loaded into the Options struct used by the codegen package. A number of the former flags are ignored, and the former configuration file will fail to load with default settings.

To help you migrate your configuration options, we've provided several new flags:

  • --old-config-style: When set, we will correctly parse all flags and configuration files in the previous way. When it becomes inconvenient to maintain this flag, we will remove it.
  • --output-config: When set, oapi-codegen will output a new-style configuration file based from all flags and an existing configuration file. Combined with the previous flag, you can use the tool to update your configuration files.

If previously you were running a command like:

oapi-codegen --package=petshop --generate="types,client,server,spec" -alias-types petshop-expanded.yaml

You will now get an error:

error processing flags: flags --alias-types aren't supported in new config style, please use --old-style-config or update your configuration

By adding the --old-config-style, code will be generated:

oapi-codegen --old-config-style  --package=petshop --generate="types,client,server,spec" -alias-types petshop-expanded.yaml

But, we're moving away from flags, so you can generate a config file like so:

oapi-codegen --output-config --old-config-style  --package=petshop --generate="types,client,server,spec" -alias-types petshop-expanded.yaml

And you will see this output:

package: petshop
generate:
  echo-server: true
  client: true
  models: true
  embedded-spec: true

You can save that to a config file, and use that to configure oapi-codegen in the future.

oapi-codegen --config config.yaml petshop-expanded.yaml

Schema merging for allOf has been rewritten

The expanded petstore example contains an allOf schema which merges NewPet properties with an ID:

    Pet:
      allOf:
</tr></table> 

... (truncated)

Commits
  • 6e66df9 Rewrite configuration options
  • 9c4d551 Generate aliases instead of typedefs
  • 920beb4 Fix marshaling of aliased custom types
  • ec460d3 Move test specs to embedded files
  • 6a34824 Add form tag to parameters.
  • 7298f44 Clean up enum spacing
  • cfb1d65 Small readme update
  • b4ccc36 Apply syntax highlighting to SecurityProvider documentation (#576)
  • 58e7d51 Update enum conflict resolution.
  • 42f4388 Use lower-cased x-go-name for parameters var name (#574)
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot bot added dependencies Pull requests that update a dependency file go Pull requests that update Go code labels Jun 28, 2022
@dependabot dependabot bot force-pushed the dependabot/go_modules/github.com/deepmap/oapi-codegen-1.11.0 branch 3 times, most recently from c525c03 to 566aac1 Compare June 28, 2022 11:36
Bumps [github.com/deepmap/oapi-codegen](https://github.com/deepmap/oapi-codegen) from 1.9.0 to 1.11.0.
- [Release notes](https://github.com/deepmap/oapi-codegen/releases)
- [Commits](deepmap/oapi-codegen@v1.9.0...v1.11.0)

---
updated-dependencies:
- dependency-name: github.com/deepmap/oapi-codegen
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot force-pushed the dependabot/go_modules/github.com/deepmap/oapi-codegen-1.11.0 branch from 566aac1 to 06c15f2 Compare June 28, 2022 23:43
@yamamoto-febc
Copy link
Member

yamamoto-febc commented Jun 28, 2022

関連: #28

oapi-codegen側で以下のPRがマージされた(v1.10)ため独自でテンプレートを持たなくて良くなっているはず。
deepmap/oapi-codegen#481

このPRで合わせて対応する。

v1.11に対応するために--old-config-styleフラグの追加と設定ファイルでのcompatibility追加を行う。

v1.11で設定ファイルの項目が変更されているが、Goのテンプレートをyamlに埋め込む対応が必要であり煩雑なため
当面は--old-config-styleを指定することで旧形式の設定ファイルを利用する。

また、v1.11でallOfやenumの扱いが変わっており、既存コードとの互換性がなくなってしまうことから
設定ファイルでcompatibility句を追加することで従来の挙動をさせる。

一旦このような対応とするが、今後のoapi-codegenの開発状況を見ながらv1.11の新しい挙動に合わせるかを随時検討する。
@yamamoto-febc yamamoto-febc merged commit 20084a0 into main Jun 29, 2022
@yamamoto-febc yamamoto-febc deleted the dependabot/go_modules/github.com/deepmap/oapi-codegen-1.11.0 branch June 29, 2022 03:45
yamamoto-febc added a commit to yamamoto-febc/object-storage-api-go that referenced this pull request Jun 29, 2022
phy-api-goでの[oapi-codegen v1.11対応](sacloud/phy-api-go#101
さらにcompatibilityにold-aliasing: trueを追加してエラーを回避している。
yamamoto-febc added a commit to sacloud/object-storage-api-go that referenced this pull request Jun 29, 2022
phy-api-goでの[oapi-codegen v1.11対応](sacloud/phy-api-go#101
さらにcompatibilityにold-aliasing: trueを追加してエラーを回避している。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant