Skip to content

Support format: uuid #707

Closed as duplicate
Closed as duplicate

Description

@liambutler-lawrence

Motivation

Our API spec heavily uses UUID-typed fields, which are represented in our OpenAPI doc using format: uuid as described in the JSONSchema spec.

However, swift-openapi-generator currently ignores that part of the OpenAPI doc and generates them all as Swift.String, meaning we have to manually call UUID.uuidString and UUID(uuidString:) (and implement required error handling on the latter).

Proposed solution

Make the generator respect format: uuid and define such fields using the Swift UUID type.

Alternatives considered

No response

Additional information

No response

Activity

  1. simonjbeaumont commented on Dec 20, 2024

    @simonjbeaumont
    Collaborator

    Thanks for filing this @liambutler-lawrence.

    This is a duplicate of #375, which is a more general ask for generating more typed values.

    There's an open PR, #627, that specifically adds support for UUID, but that's currently blocked on working out a backwards compatibility story (see #627 (comment)).

  2. added
    area/openapiAdding/updating a feature defined in OpenAPI.
    and removed
    status/triageCollecting information required to triage the issue.
    on Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/openapiAdding/updating a feature defined in OpenAPI.kind/featureNew feature.status/blockedWaiting for another issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions