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 auto-generated title in JSON schemas #772

Merged
merged 2 commits into from Aug 21, 2019

Conversation

@skewty
Copy link
Contributor

skewty commented Aug 21, 2019

Underscore is converted to space.
Closes #743

NOTE the following unit test is not passing for me:

tests/test_validators.py:641 (test_assert_raises_validation_error)
def test_assert_raises_validation_error():
        class Model(BaseModel):
            a: str
    
            @validator('a')
            def check_a(cls, v):
                assert v == 'a', 'invalid a'
                return v
    
        Model(a='a')
    
        with pytest.raises(ValidationError) as exc_info:
            Model(a='snap')
        injected_by_pytest = "\nassert 'snap' == 'a'\n  - snap\n  + a"
>       assert exc_info.value.errors() == [
            {'loc': ('a',), 'msg': f'invalid a{injected_by_pytest}', 'type': 'assertion_error'}
        ]
E       assert [{'loc': ('a',),\n  'msg': "invalid a\nassert 'snap' == 'a'",\n  'type': 'assertion_error'}] == [{'loc': ('a',),\n  'msg': "invalid a\nassert 'snap' == 'a'\n  - snap\n  + a",\n  'type': 'assertion_error'}]

tests/test_validators.py:656: AssertionError
Underscore is converted to space.
@samuelcolvin

This comment has been minimized.

Copy link
Owner

samuelcolvin commented Aug 21, 2019

Looks good to me, please add a change description.

In general best to keep the checkboxes from the PR template, but doesn't matter this time.

Scott Palmer
@samuelcolvin samuelcolvin merged commit 5015a7e into samuelcolvin:master Aug 21, 2019
9 checks passed
9 checks passed
Header rules No header rules processed
Details
Pages changed All files already uploaded
Details
Redirect rules No redirect rules processed
Details
Mixed content No mixed content detected
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
deploy/netlify Deploy preview ready!
Details
samuelcolvin.pydantic Build #20190821.21 succeeded
Details
samuelcolvin.pydantic (Job Python36) Job Python36 succeeded
Details
samuelcolvin.pydantic (Job Python37) Job Python37 succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.