Giter Site home page Giter Site logo

Comments (4)

czechboy0 avatar czechboy0 commented on September 22, 2024

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.

avnerbarr avatar avnerbarr commented on September 22, 2024

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.

czechboy0 avatar czechboy0 commented on September 22, 2024

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.

avnerbarr avatar avnerbarr commented on September 22, 2024

Yes I am filtering. I have a new question now :) will open a separate topic

from swift-openapi-generator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.