Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve failure output #10

Closed
estahn opened this issue Jul 22, 2022 · 3 comments
Closed

Improve failure output #10

estahn opened this issue Jul 22, 2022 · 3 comments

Comments

@estahn
Copy link
Contributor

estahn commented Jul 22, 2022

I receive the following failure output:

SECRET_KEY
  field required (type=value_error.missing)

The SECRET_KET config looks as follows:

SECRET_KEY: str = Field(default=Undefined, env='DJANGO_SECRET_KEY')

Given I'm using environment variables to pass in the configuration I can not discern the issue from looking at the output, e.g. I don't know I have to provide a value in DJANGO_SECRET_KEY until looking into the code.

Would it be possible to provide more details, possibly the entire config for this field? I see there are title and description available, which could be helpful too:

SECRET_KEY: str = Field(default=Undefined, env='DJANGO_SECRET_KEY', title="Secret key", description="lorem ipsum...")

Possible solution:

SECRET_KEY
  Error: field required (type=value_error.missing)
  Title: Secret Key
  Description: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed suscipit, orci
      nec facilisis tristique, nibh leo pretium mi, sed consequat nibh magna sit amet elit. Maecenas
      tempus porta tellus eu feugiat. Phasellus eget vehicula libero. Donec eget augue
      pellentesque, condimentum elit sed, lobortis est. Fusce eu risus placerat, mollis dolor at,
      convallis mi.
  Env: DJANGO_SECRET_KEY
@erhosen
Copy link
Collaborator

erhosen commented Jul 31, 2022

Thank you, I will think about it

@l1b3r
Copy link
Contributor

l1b3r commented Aug 30, 2022

While I appreciate the usefulness of the request, I think it should be addressed to Pydantic directly as it is the thing which is performing the heavy-lifting of validation and prints the output you are referring to.

@erhosen
Copy link
Collaborator

erhosen commented Jan 12, 2023

^

@erhosen erhosen closed this as completed Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants