question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generated intermediate models may shadow imports

See original GitHub issue

Hey, great library, thank you!

Describe the bug

See Optional

To Reproduce

Example schema:

components:
  schemas:
    Config:
      properties:
        optional:
          type: object
          additionalProperties:
            type: array
            items:
              type: string

Used commandline:

$ datamodel-codegen --input-file-type openapi --strip-default-none --input test.yaml --output model.py

Produced:

from __future__ import annotations

from typing import Dict, List, Optional

from pydantic import BaseModel


class Optional(BaseModel):
    __root__: List[str]


class Config(BaseModel):
    optional: Optional[Dict[str, Optional]]

Version:

  • OS: Windows 10
  • Python version: 3.8
  • datamodel-code-generator version: 0.7.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ofekcommented, Mar 4, 2021

Awesome, thank you!

1reaction
ofekcommented, Feb 16, 2021

@koxudaxi Take your time! Do the correct approach

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python import: Advanced Techniques and Tips
The Python import system is as powerful as it is useful. In this in-depth tutorial, you'll learn how to harness this power to...
Read more >
Casting Real-World Shadows
With SketchUp's Shadows feature, you can make your model cast a basic shadow or see how the sun casts shadows on or around...
Read more >
Sun Shadow Volume—Help | ArcGIS for Desktop
ArcGIS geoprocessing tool that creates a model of the shadows cast by each input feature using sunlight on a given date and time....
Read more >
Common problems and their solutions | Lumion 3D Best ...
Let's start with some of the most common problems that you may face while importing 3D models: Problem: When you import a 3D...
Read more >
box-shadow - CSS: Cascading Style Sheets - MDN Web Docs
Interpolation determines intermediate values of properties, such as the blur radius, spread radius, and color, as shadows transition. For each ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found