Missing import for Field
See original GitHub issueDescribe the bug
To Reproduce
Example schema:
example file https://raw.githubusercontent.com/kubernetes/kubernetes/1.16.4/api/openapi-spec/swagger.json
Generated code in io/k8s/apimachinery/pkg/version.py
:
from __future__ import annotations
from pydantic import BaseModel
class Info(BaseModel):
build_date: str = Field(..., alias="buildDate")
compiler: str
git_commit: str = Field(..., alias="gitCommit")
git_tree_state: str = Field(..., alias="gitTreeState")
git_version: str = Field(..., alias="gitVersion")
go_version: str = Field(..., alias="goVersion")
major: str
minor: str
platform: str
Expected behavior
from pydantic import BaseModel, Field
Version:
- OS: Linux
- Python Verison: 3.8
- datamodel-code-generator master
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Missing import fields - WordPress.org
Hi,. We are trying out WP Import Export with intent to purchase if it does the job. All WordPress and plugin's are up...
Read more >Error 'Required fields are missing' when you import records ...
This error occurs when the field in question is a master-detail field, and the field has been mapped during import but contains no...
Read more >Missing fields for mapping when importing issues through ...
The expected field is not mapped in the Field Mapping step of CSV import. · Go into the respective project administration screen ·...
Read more >2324361 - Missing fields in Job Information import template
A field is missing in Job Information import template, though it is available in the UI. ... This happens if field is set...
Read more >Fields missing in Easy import Excel template
Check the user who is performing Easy import is having access to the problematic table field and rule out the access control issue....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @koxudaxi,
I am sorry. This isn’t and issue with your code but with mine! I have a custom parser that adds aliases.
Closing this.
I have a function I run over all fields:
snakify_field
: https://github.com/FlorianLudwig/pdk8s/blob/master/pdk8s/gen_k8s.py#L59 - but it’s buggy as noticed in this report 😓