GithubHelp home page GithubHelp logo

Comments (4)

amtelekom avatar amtelekom commented on June 19, 2024 1

#318 and #670 are about similar problems.
#671 implemented a solution for the generics problem, but sadly got no feedback so far.

The current output is non-compliant with the OpenAPI spec, even if SwaggerUI & Co don't complain:

All the fixed fields declared above are objects that MUST use keys that match the regular expression: ^[a-zA-Z0-9.-_]+$

(https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#components-object)

The problem I see with both your suggestion (Prefix with ListOf instead of wrapping in brackets) as well as the one in #671 (replace special characters with underscore) is that it might collide with non-generics that use the same name - but IMHO both solutions would be preferable to just not be able to use Generics at all without generating invalid OpenAPI specs.

@sunli829 would you be open to a PR that removes the disallowed characters, and if so, do you have a preference for the format (i.e., replace punctuation with underscores, Prefix with a String like "Of", ...)?

from poem.

sunli829 avatar sunli829 commented on June 19, 2024

Currently it is not possible to customize the OpenAPI name corresponding to a generic type. If you need a legal name, you can only avoid using generics.

from poem.

rxdiscovery avatar rxdiscovery commented on June 19, 2024

I have a proposition,
why not take the template ( [{}] ) directly from a global variable, which can be modified?

  fn name() -> Cow<'static, str> {
        format!("[{}]", T::name()).into() 
    }

to

  fn name() -> Cow<'static, str> {
        format!(get_vec_gen_template(), T::name()).into() 
    }

from poem.

rxdiscovery avatar rxdiscovery commented on June 19, 2024

Hello,

@amtelekom if we make the template dynamic so that each developer can customize it only for their needs

I think @sunli829 is so busy lately, it would be nice if he assigned a moderator to help him.

from poem.

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.