Skip to content

Releases: astahmer/openapi-zod-client

[email protected]

27 Dec 08:52
Compare
Choose a tag to compare

Minor Changes

[email protected]

21 Dec 09:30
Compare
Choose a tag to compare

Minor Changes

[email protected]

14 Dec 22:29
Compare
Choose a tag to compare

Patch Changes

[email protected]

14 Dec 10:29
Compare
Choose a tag to compare

Patch Changes

  • #251 2859ede Thanks @ezze! - Fix "Cannot read properties of undefined (reading 'ref')" type error for file group strategies

[email protected]

05 Dec 22:58
Compare
Choose a tag to compare

Patch Changes

  • #248 fd5f850 Thanks @nmcdaines! - Fixes an issue whereby you aren't able to set additionalPropsDefaultValue from command line as false because the package expects it to be a boolean, however recieves a string value

  • #249 8dfb265 Thanks @nmcdaines! - Fix issue using discriminated union when there are multiple items within an allOf block by reverting to a union type for this case

  • #247 1e1dcd8 Thanks @tillschweneker! - When a property from an external json or yaml file starts with a number, e.g. 1st, instead of first, the generated Zod-Schema is corrupt. The change in the wrapWithQuotesIfNeeded method makes sure, that any property starting with a number is wrapped in quotes.

[email protected]

03 Nov 14:31
Compare
Choose a tag to compare

Patch Changes

  • #242 81efd49 Thanks @imballinst! - chore: make endpointDefinitionRefiner to receive final fields that are going to be used in handlebars

[email protected]

28 Sep 14:57
Compare
Choose a tag to compare

Minor Changes

  • #234 096d8b4 Thanks @ArthurGoupil! - Add option withAllResponses to be receive a responses array containing all responses (succes & error)

[email protected]

27 Sep 10:25
Compare
Choose a tag to compare

Patch Changes

[email protected]

26 Sep 22:45
Compare
Choose a tag to compare

Minor Changes

  • 7396fe8 Thanks @astahmer! - Add additionalPropsDefaultValue flag in case additionalProperties is not provided

[email protected]

22 Sep 20:07
Compare
Choose a tag to compare

Patch Changes

  • 536a541 Thanks @astahmer! - Thanks @mayorandrew !


    OpenAPI 3.0.3 Data Types are defined by JSON Schema Specification Wright Draft 00.

    However, the specification mentions that "null is not supported as a type" and the nullable keyword should be used instead. While it is a valid solution in most cases, it is not possible to use nullable together with $ref. One possible workaround is to define a Null schema and use it in combination with oneOf, like so:

    {
        "oneOf": [
            { "$ref": "#/components/schemas/MySchema" },
            {
                "type": "string",
                "enum": [null],
                "nullable": true
            }
        ]
    }

    It may look contradictory, but according to the enum section of JSON Schema Validation Wright Draft 00:

    The value of this keyword MUST be an array. This array SHOULD have
    at least one element. Elements in the array SHOULD be unique.

    Elements in the array MAY be of any type, including null.

    An instance validates successfully against this keyword if its value
    is equal to one of the elements in this keyword's array value.

    This means that null is a possible value for the "enum" validation of "type" "string".

    This schema also passes the swagger-cli validate check.

    The openapi-zod-client library currently crashes when generating a TypeScript type for this construct. Additionally, the generated zod schemas are not correct when using a null value in "enum" along with other values. This PR fixes that.

    #227