Skip to content

export enum values in generated TS SDK #11384

@gavinsharp

Description

@gavinsharp

Which Fern component?

SDK Generator

How important is this?

P2 - Medium (Would be helpful)

What's the feature?

Similar request to #5512, but for Typescript.

It would be nice for TS SDK consumers to be able to reference valid enum values from the generated SDK. Currently types are exported, but there are no run-time values generated that satisfy those type constraints, so SDK consumers effectively have to duplicate the enums.

Example

We have an OpenAPI spec that contains a schema with an enum property, e.g.:

components:
  schemas:
    Lang2FhirAndCreateRequest:
      type: object
      required:
        - resource
        - text
      properties:
        resource:
          type: string
          description: >
            Type of FHIR resource to create.
            Use 'auto' for automatic resource type detection, or specify a supported US Core profile.
          example: "condition-encounter-diagnosis"
          enum: [auto, appointment, condition-encounter-diagnosis, medicationrequest, careplan, condition-problems-health-concerns, coverage, encounter, observation-clinical-result, observation-lab, patient, procedure, questionnaire, questionnaireresponse, simple-observation, vital-signs]

That type is exported from our TS SDK (as phenoml.tools.Lang2FhirAndCreateRequest), but the relevant const is not available to consumers, so they don't have an easy way to access valid values for the resource parameter at runtime.

Any alternatives?

No response

Are you interested in contributing this feature?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions