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

Fix schema for timedelta as number, instead of str #325

Merged
merged 1 commit into from Dec 23, 2018

Conversation

tiangolo
Copy link
Member

Change Summary

Currently, the generated schema for datetime.timedelta is as string.

But by default, Pydantic will convert it to a float with the difference in seconds.

(Bug created by me in the JSON Schema compatibility PR).

This PR fixes that and makes the schema for timedelta be a number by default, which corresponds to the actual behavior.

Related issue number

I didn't create one.

Performance Changes

pydantic cares about performance, if there's any risk performance changed on this PR,
please run make benchmark-pydantic before and after the change:

  • before: ?
  • after: ?

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes
  • No performance deterioration (if applicable)
  • HISTORY.rst has been updated
    • if this is the first change since a release, please add a new section
    • include the issue number or this pull request number #<number>
    • if you're not a regular contributer please include your github username @whatever

@codecov
Copy link

codecov bot commented Dec 22, 2018

Codecov Report

Merging #325 into master will not change coverage.
The diff coverage is n/a.

@@          Coverage Diff          @@
##           master   #325   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          13     13           
  Lines        1771   1771           
  Branches      344    344           
=====================================
  Hits         1771   1771

@samuelcolvin samuelcolvin merged commit 81f1558 into pydantic:master Dec 23, 2018
@samuelcolvin
Copy link
Member

great, thanks. will release in a couple of days.

@tiangolo
Copy link
Member Author

Awesome, thanks. 🎉

alexdrydew pushed a commit to alexdrydew/pydantic that referenced this pull request Dec 23, 2023
* adding multi host urls

* linting and more test cases

* tweak unicode_string logic to replace range

* consume leading whitespace on multihost urls

* yet more test cases

* improve coverage

* add vulnerabilties tests

* remove "host_type" from url

* fix unicode positioning with multihost urls

* uprev

* allow default_host, default_port, default_path

* fix schema vs. scheme typo

* empty hosts() if no host

* tweaking url public methods
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

Successfully merging this pull request may close these issues.

None yet

2 participants