Coder Social home page Coder Social logo

Comments (6)

koxudaxi avatar koxudaxi commented on May 22, 2024 2

@fzirker
Thank you for writing detail about the problem.

I have understood. I will re-use converting logic of field name for generating model name.
I'm sorry, I have some tasks. I want to implement this issue in this week or next week.

from datamodel-code-generator.

fzirker avatar fzirker commented on May 22, 2024 2

I've tested it now, works perfectly now.
Thank your very much.

from datamodel-code-generator.

bennypowers avatar bennypowers commented on May 22, 2024 1

edit: SOLVED: I discovered x-enum-vars. thanks!

I have a schema in an openapi 3 yaml file:

components:
  schemas:
    EmissionUnit:
          type: "string"
          enum: ["Kg CO₂", "Kg CO₂e", "tonnes CO₂e"]

and I get :

black.InvalidInput: Cannot parse: 59:9: Kg_CO₂ = 'Kg CO₂'

from datamodel-code-generator.

koxudaxi avatar koxudaxi commented on May 22, 2024

@fzirker
I have released a fixed version as 0.5.12 🎉

from datamodel-code-generator.

fzirker avatar fzirker commented on May 22, 2024

Hi @koxudaxi thank your for your work.

Unfortunately I have a problem with the new version. The fields with spaces are now optional.
Example created with the new version 0.5.12 (from sample above):
Serial_Number: Optional[str] = Field(None, alias='Serial Number')

With old version 0.5.11 the field were defined like this.
Serial_Number: str = Field(..., alias='Serial Number')

from datamodel-code-generator.

koxudaxi avatar koxudaxi commented on May 22, 2024

@fzirker
Oh, I'm sorry, I mistake it.
I have fixed and released it as 0.5.13

from datamodel-code-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.