Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Runtime] Generate server variables #64

Merged
merged 3 commits into from
Oct 26, 2023

Conversation

czechboy0
Copy link
Collaborator

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
8 checks passed
@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.

None yet

2 participants