You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Motivation
Picking up after some time from this issue
#375
There are some usecases described here that i think could be addressed
by this.
I suspect there are some "bigger picture" decisions (maybe proposals)
needing to happen so i wanted to get the ball rolling :)
### Modifications
I made a small change allowing to "swap in" any type instead of
generating one, by using a vendor-extension
(`x-swift-open-api-substitute-type`)
### Result
The following spec
```yaml
openapi: 3.1.0
info:
title: api
version: 1.0.0
components:
schemas:
MyCustomString:
type: string
x-swift-open-api-substitute-type: MyLibrary.MyCustomString
```
would generate code like this (abbreviated)
```swift
public enum Components {
public enum Schemas {
/// - Remark: Generated from `#/components/schemas/MyCustomString`.
public typealias MyCustomString = MyLibrary.MyCustomString
}
}
```
### Test Plan
I did write a test but suspect theres, other parts affected that i
missed
---------
Co-authored-by: simonbility <[email protected]>
Co-authored-by: Honza Dvorsky <[email protected]>
An example project using [Swift OpenAPI Generator](https://github.com/apple/swift-openapi-generator).
4
+
5
+
> **Disclaimer:** This example is deliberately simplified and is intended for illustrative purposes only.
6
+
7
+
## Overview
8
+
9
+
This example shows how to use [type overrides](https://swiftpackageindex.com/apple/swift-openapi-generator/documentation/swift-openapi-generator/configuring-the-generator) with Swift OpenAPI Generator.
/// Validates all type overrides from a Config are present in the components of a ParsedOpenAPIRepresentation.
256
+
///
257
+
/// This method iterates through the type overrides defined in the config and checks that for each of them a named schema is defined in the OpenAPI document.
258
+
///
259
+
/// - Parameters:
260
+
/// - doc: The OpenAPI document to validate.
261
+
/// - config: The generator config.
262
+
/// - Returns: An array of diagnostic messages representing type overrides for nonexistent schemas.
0 commit comments