Skip to content

Conversation

czechboy0
Copy link
Contributor

Motivation

The runtime side of apple/swift-openapi-generator#24.

Modifications

Added an SPI ServerVariable type and a variant of the URL.init(validatingOpenAPIServerURL:variables:) method, which takes the template and variables and returns a fully formed concrete URL.

Result

Unblocked the generator half of supporting server variables.

Test Plan

Added unit tests.

@czechboy0 czechboy0 merged commit 51bdb07 into apple:main Oct 26, 2023
@czechboy0 czechboy0 deleted the hd-server-variables branch October 26, 2023 12:25
@czechboy0 czechboy0 added the 🔨 semver/patch No public API change. label Oct 26, 2023
czechboy0 added a commit to apple/swift-openapi-generator that referenced this pull request Oct 26, 2023
[Generator] Generate server variables

### Motivation

The generator side of #24. Depends on apple/swift-openapi-runtime#64 landing and getting released.

### Modifications

See the file-based reference tests first to get a sense of how server variables work in templates. Most of this PR is test changes, plus slightly changed formatting of arrays, to put each item on new line for non-empty ones.

### Result

Server variables are supported, allowing e.g. services that have enterprise versions to use the feature instead of having to hardcode the remote URL.

### Test Plan

Adapted tests.


Reviewed by: glbrntt

Builds:
     ✔︎ pull request validation (5.10) - Build finished. 
     ✔︎ pull request validation (5.8) - Build finished. 
     ✔︎ pull request validation (5.9) - Build finished. 
     ✔︎ pull request validation (compatibility test) - Build finished. 
     ✔︎ pull request validation (docc test) - Build finished. 
     ✔︎ pull request validation (integration test) - Build finished. 
     ✔︎ pull request validation (nightly) - Build finished. 
     ✔︎ pull request validation (soundness) - Build finished. 

#348
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants