apple / apple/swift-openapi-generator
Support `format: uuid`
- Dominant language
- Swift
- Stars
- 2k
- Forks
- 182
- Avg merge
- 13h 28m
- Merged PRs (30d)
- 5
Description
### 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](https://json-schema.org/understanding-json-schema/reference/string#resource-identifiers).
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_
Contributor guide
Research direction
No file or test is named in the issue. Start by tracing the generator's OpenAPI schema type-mapping entry point for string formats, then verify that fields declared with format: uuid generate as Swift.UUID rather than Swift.String and that the existing generated-code tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, swift
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100