Skip to content

Support for unevaluatedProperties #2839

Description

@abrenneke

Description

See reference and spec.

Currently, for the following schema:

{
    "type": "object",
    "unevaluatedProperties": {
        "type": "string"
    }
}

The library will output a Record<string, never>.

Proposal

Instead, at minimum it should function like additionalProperties and output something like a BaseObjectType & Record<string, UnevaluatedPropertyType>.

Perhaps more accurately, it might be something like an ExclusifyUnion<BaseObjectType> & UnevaluatedPropertyType (using type-fest), because the unevaluated properties only apply to keys not present on any of the possible values of BaseType (the Record by itself will overwrite keys that any of the types don't have).

Here's a TS Playground explaining what I mean.

Extra

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestopenapi-tsRelevant to the openapi-typescript library

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions