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.

Missing import for Field

See original GitHub issue

Describe 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:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
FlorianLudwigcommented, Jun 21, 2020

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.

0reactions
FlorianLudwigcommented, Jun 22, 2020

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 😓

Read more comments on GitHub >

github_iconTop 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 >

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