Skip to content

Property provider.name defined as const keyword not properly converted #4

@fredericbarthelet

Description

@fredericbarthelet

Use case description

The current schema generates the following typescript type for provider.name property :

provider: {
  name: {
    [k: string]: unknown;
  };
  //...
}

However, the JSON schema configuration for this property states:

provider: {
  type: 'object',
  properties: {
    name: { const: 'aws' },
    //...
  }
}

The const JSON schema keyword is not currently supported by json-schema-to-typescript - introduced in JSON Schema v6

Proposed solution

As pointed out in the issue, de-sugaring const to a single-value enum solves the issue - bcherny/json-schema-to-typescript#264 (review)

This seems like the only viable way of solving this until a new maintainer for the repo is found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions