Comments (4)
Hi @avnerbarr,
as mentioned in #516, the issue here is that the OpenAPI document didn't specify the operationId
field for each operation. Either ask the vendor to provide it, or edit the OpenAPI document yourself and add that field to each operation, at which point you'll see exactly those names in the generated code, as long as you keep to the character set recommended by the OpenAPI specification in: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#fixed-fields-8
A safe character set to use for operationId is [a-zA-Z0-9_]
.
from swift-openapi-generator.
Thanks for the explanation!
I see that the /
characters in the API path are replaced with sol
, for example here:
/// - Remark: HTTP `GET /api/v3/ticker/price`.
/// - Remark: Generated from `#/paths//api/v3/ticker/price/get`.
get_sol_api_sol_v3_sol_ticker_sol_price
What does sol
stand for? Is there a simple way (the spec is a few thousand lines long) to remove that? Is is prolific all over.
Thanks!
from swift-openapi-generator.
The sol
is the replacement word for the /
character, since a slash isn't a legal character in a Swift identifier. Details here: https://swiftpackageindex.com/apple/swift-openapi-generator/1.2.0/documentation/swift-openapi-generator/soar-0001
You could use some custom automation that preprocesses your OpenAPI document, but you might also consider opening a PR to the upstream OpenAPI document and adding well thought-out operationId
for each operation, that way everyone can benefit.
In either case, Swift OpenAPI Generator is a tool that generates Swift code from an OpenAPI document, so processing of OpenAPI documents themselves is out of scope of this tool.
You might also check out the filtering feature, if you're only using a small subset of the OpenAPI document in your project: https://swiftpackageindex.com/apple/swift-openapi-generator/1.2.0/documentation/swift-openapi-generator/configuring-the-generator#Document-filtering
from swift-openapi-generator.
Yes I am filtering. I have a new question now :) will open a separate topic
from swift-openapi-generator.
Related Issues (20)
- Need to be able to support multiple OpenAPI specs HOT 2
- Tutorial doc text color issue on light theme HOT 1
- Check for updated spec before generating HOT 2
- Warnings due to `@frozen` attribute on non-public enums with Xcode 16 Beta 3 HOT 5
- Support multiple contentTypes in encoding multipart/form-data HOT 7
- multipart/form-data request body schemas with additionalProperties are a bit confusing to use, also doesn't compile HOT 7
- Multipart generated enum case naming is inconsistent (other vs additionalProperties) HOT 3
- Add `consuming` Modifier to Middleware Intercept Method Parameters HOT 8
- Hyphen in path variable name results in static path variable name in url HOT 4
- The output formatting of JSON encoding/decoding should be more configurable HOT 1
- HTTPBody does not conform to Decodable? HOT 2
- [Support enumUnknownDefaultCase] Is there a way to add default case for generated enums? HOT 5
- Add option to set a status code for server error / runtime error on a case by case basis HOT 1
- Generator lacks necessary write permissions HOT 5
- Sharing schemas with main application HOT 12
- Error during build: Injecting stub binary into codeless framework HOT 4
- Optimising build time HOT 4
- Different Return Types Depending on the Request Made to the /chat/completions Endpoint in the OpenAI OpenAPI HOT 4
- Mapping to an AsyncSequence without exposing the generated internal types HOT 6
- Generating Debug Output HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift-openapi-generator.