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

chore(): v2.1.0 upstream #3

Closed
wants to merge 26 commits into from
Closed

chore(): v2.1.0 upstream #3

wants to merge 26 commits into from

Conversation

debuggerpk
Copy link

No description provided.

jamietanna and others added 26 commits November 6, 2023 16:11
To give us a more consistent set of release notes, especially now we're
using multi-repo setup, we can use it to build our upcoming release's
changelog with a centrally configured + managed configuration.
…ly (oapi-codegen#1315)

Corresponding with changes in the runtime package, we want to ensure we
let the (newly added) `BindStyledParameterWithOptions` function knows
whether a parameter is required, to not error when an empty value is
provided.

Closes oapi-codegen#954.
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…i-codegen#1385)

Right now, we're only generating code for multipart requests when the
media type is a `multipart/form-data`, which means that other multipart
types, like `multipart/related` do not correctly generate.

We should amend this, generating code that validates the media type
provided and handling the request.

Closes oapi-codegen#1381.
Although not _technically_ a valid extension to JSON according to [the
media type definition], it's got a number of services using it for a `v`
or `version` parameter, so we should support this as a valid option.

This makes sure that we parse it as a valid media type, performing the
same checks as we did before by ignoring the parameters.

[the media type definition]: https://www.iana.org/assignments/media-types/application/json
When using the strict server, binding a request body that is JSON
compatible - but not `application/json` - will result in errors.

We can therefore correctly bind the body using `ShouldBindJSON`.

Closes oapi-codegen#1298.
As part of oapi-codegen/runtime v1.1.0, we renamed these for common
initialisms and deprecated the existing methods, which means this may
show up as a warning in IDEs or tooling.
As part of follow-up changes we're making changes to `GoTypeDef`, so
it's handy to have some confidence that the existing behaviour isn't
affected by the changes.

Co-authored-by: Ashutosh Kumar <[email protected]>
As part of oapi-codegen#1039, we've created a new library `oapi-codegen/nullable`,
which allows tracking whether:

- a field is not sent
- a field is sent with an explicit `null`
- a field is sent with an explicit value

This introduces an opt-in `output-options` flag, `nullable-type`, which
can generate the `nullable.Nullable` types.

This is opt-in, as existing code will break due to the signature change,
as well as a behaviour change.

Closes oapi-codegen#1039.

Co-authored-by: Ashutosh Kumar <[email protected]>
As raised in oapi-codegen#1426, it isn't immediately clear how you could use the
import mapping for a URL, so we should amend `externalref` to make it
super clear.

Closes oapi-codegen#1426.
The current approach doesn't often work when generating types that are
in external packages, unless that package is also a strict server's
definition, which isn't always the case.
As part of follow-up changes, we'll need it, and it's handy to keep this
consistent with other types that have this.
In the case that we're referencing a type defined in an external
package, using an alias here results in build errors i.e.:

  ./api.gen.go:93:7: cannot define new methods on non-local type common.TypeNameHere

Instead, we can make sure we only alias when there's not an external
reference in use, using the new `Schema.IsExternalRef` function.
…en#1414)

Fixes indentation for "Registering handlers" example code for Gin.

Fixes indentation in README example code.
As noted in oapi-codegen#1247, in some cases it can be useful to have arrays defined
as a concrete type, not a type alias, so you are able to extend them
with methods.

This produces a new opt-in output-option,
`disable-type-aliases-for-type`, which can be used to control this
behaviour

Right now, we only want to add support for `array`s, but the
configuration is extensible in the future.

This also introduces a test case to demonstrate the capabilities.

We need to introduce a `sliceContains` method to simplify this lookup,
as we don't yet have `slices.Contains` due to the Go versions we're
targeting.
As noted in oapi-codegen#428, there are some cases where it can be useful to set the
field ordering.

This adds support for the `x-order` extension used by other OpenAPI
parsers and generators, and ensures that we return keys sorted by that
order, if present.

This also adds a relevant test case + unit tests to validate
functionality.

Closes oapi-codegen#428.

Co-authored-by: Filinto Duran <[email protected]>
Signed-off-by: Filinto Duran <[email protected]>
Co-authored-by: Andrew Rusakow <[email protected]>
Co-authored-by: Jamie Tanna <[email protected]>
As noted in oapi-codegen#1378, there are cases where a complex set of `$ref`s
between multiple files can lead to broken generated code, which does not
correctly import the package that has been prepared for the external
reference.

We can handle this by looking up any references, where there is a `.Ref`
passed into the type, and then iterate through relevant children.

This requires we handle the updating in-place for these by using a bit
of pointer + indexing fun.

This also adds a relevant test case to validate the fix.

Closes oapi-codegen#1378.
Signed-off-by: Yousuf Jawwad <[email protected]>
@debuggerpk debuggerpk closed this Apr 30, 2024
@debuggerpk debuggerpk deleted the master branch April 30, 2024 01:54
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.