
GITHUB . COM {
}
Detected CMS Systems:
- Wordpress (2 occurrences)
Title:
Extra allOf keys in translation of Unions to OpenAPI schema when Field is used Β· Issue #1209 Β· pydantic/pydantic
Description:
Bug Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())": pydantic version: 1.4 pydantic compiled: False install path: C:\Users\chris\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\pydantic pytho...
Website Age:
17 years and 8 months (reg. 2007-10-09).
Matching Content Categories {π}
- Transportation
- Technology & Computing
- Video & Online Content
Content Management System {π}
What CMS is github.com built with?
Github.com is based on WORDPRESS.
Traffic Estimate {π}
What is the average monthly size of github.com audience?
ππ Tremendous Traffic: 10M - 20M visitors per month
Based on our best estimate, this website will receive around 10,653,586 visitors per month in the current month.
check SE Ranking
check Ahrefs
check Similarweb
check Ubersuggest
check Semrush
How Does Github.com Make Money? {πΈ}
Subscription Packages {π³}
We've located a dedicated page on github.com that might include details about subscription plans or recurring payments. We identified it based on the word pricing in one of its internal links. Below, you'll find additional estimates for its monthly recurring revenues.How Much Does Github.com Make? {π°}
Subscription Packages {π³}
Prices on github.com are in US Dollars ($).
They range from $4.00/month to $21.00/month.
We estimate that the site has approximately 5,316,011 paying customers.
The estimated monthly recurring revenue (MRR) is $22,327,244.
The estimated annual recurring revenues (ARR) are $267,926,929.
Wordpress Themes and Plugins {π¨}
What WordPress theme does this site use?
It is strange but we were not able to detect any theme on the page.
What WordPress plugins does this website use?
It is strange but we were not able to detect any plugins on the page.
Keywords {π}
allof, type, keys, issue, pydantic, extra, bug, title, samuelcolvin, schema, chriswmackey, testclassb, properties, object, class, testclassa, added, sign, pull, field, description, import, ref, testclassc, mentioned, commented, fix, remove, translation, openapi, bit, github, testclasscbasemodel, uniontestclassa, result, definitions, test, ladybugtoolshoneybeeschema, dmontagu, idea, mostapharoudsari, commit, references, navigation, source, code, issues, requests, actions, security,
Topics {βοΈ}
/samuelcolvin/pydantic/blob/645e5fe6a0c74c95c24410571e9bb804af3eb677/pydantic/schema pydantic source code ae8816d samuelcolvin closed extra allof keys wanted pull request pydantic version e0cd906 mostapharoudsari mentioned additional 'allof' keys typing import union samuelcolvin added extra keys users experience python unconditionally return schema_ref pydantic v1 pydantic import basemodel chriswmackey mentioned allof keys face type import pydantic union[testclassa issues openapi schema testclassb] pprint docs bug type projects class testclassc description='description github addressing fairly confident schema test cases history back test checking dmontagu add default projects milestone milestone relationships pydantic issue change testclassc [{'allof' {'allof' allof allof testclassb] = testclassa schema_extra capability expected result bit hacky
Payment Methods {π}
- Braintree
Questions {β}
- @tiangolo @dmontagu any idea what's going on here?
- @tiangolo I guess you first implemented this, any idea why it's there?
- Already have an account?
Schema {πΊοΈ}
DiscussionForumPosting:
context:https://schema.org
headline:Extra allOf keys in translation of Unions to OpenAPI schema when Field is used
articleBody:# Bug
Output of `python -c "import pydantic.utils; print(pydantic.utils.version_info())"`:
```
pydantic version: 1.4
pydantic compiled: False
install path: C:\Users\chris\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\pydantic
python version: 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) [MSC v.1915 32 bit (Intel)]
platform: Windows-10-10.0.18362-SP0
optional deps. installed: []
```
## Description
My teammates and I debated this for a bit but we're fairly confident that we're experiencing a bug, though it could just be a misunderstanding of how the translation to OpenAPI schema is intended to happen. We can at least say that we couldn't find any other issues on this github addressing it or samples in the docs about our case.
Specifically, when we run the following sample:
```
from pydantic import BaseModel, Field
from typing import Union
from pprint import pprint
class TestClassA(BaseModel):
pass
class TestClassB(BaseModel):
pass
class TestClassC(BaseModel):
a: Union[TestClassA, TestClassB]
pprint(TestClassC.schema())
```
... we get the expected result:
```
{'definitions': {'TestClassA': {'properties': {},
'title': 'TestClassA',
'type': 'object'},
'TestClassB': {'properties': {},
'title': 'TestClassB',
'type': 'object'}},
'properties': {'a': {'anyOf': [{'$ref': '#/definitions/TestClassA'},
{'$ref': '#/definitions/TestClassB'}],
'title': 'A'}},
'required': ['a'],
'title': 'TestClassC',
'type': 'object'}
```
However, when we change `TestClassC` to be the following:
```
class TestClassC(BaseModel):
a: Union[TestClassA, TestClassB] = Field(..., description='description...')
```
... we get the following:
```
{'definitions': {'TestClassA': {'properties': {},
'title': 'TestClassA',
'type': 'object'},
'TestClassB': {'properties': {},
'title': 'TestClassB',
'type': 'object'}},
'properties': {'a': {'anyOf': [{'allOf': [{'$ref': '#/definitions/TestClassA'}]},
{'allOf': [{'$ref': '#/definitions/TestClassB'}]}],
'description': 'description...',
'title': 'A'}},
'required': ['a'],
'title': 'TestClassC',
'type': 'object'}
```
Take particular note of the additional `'allOf'` keys under the `'properties'`
We get the same additional `'allOf'` keys if we change `TestClassC` to be the following:
```
class TestClassC(BaseModel):
a: Union[TestClassA, TestClassB] = TestClassA()
```
Right now, we're using a workaround with the `schema_extra` capability to get rid of these extra `allOf` keys but this seemed a bit hacky to us. If these `allOf` keys are the result of a bug, we're happy to provide more test cases that trigger it if that would help. Or, if there's a better way to get rid of it these extra keys that we overlooked, we're happy to help documenting it in any way that we can so others like us don't get confused. Thank you for taking the time to read this issue and for the incredibly useful package!
author:
url:https://github.com/chriswmackey
type:Person
name:chriswmackey
datePublished:2020-02-05T18:58:37.000Z
interactionStatistic:
type:InteractionCounter
interactionType:https://schema.org/CommentAction
userInteractionCount:4
url:https://github.com/1209/pydantic/issues/1209
context:https://schema.org
headline:Extra allOf keys in translation of Unions to OpenAPI schema when Field is used
articleBody:# Bug
Output of `python -c "import pydantic.utils; print(pydantic.utils.version_info())"`:
```
pydantic version: 1.4
pydantic compiled: False
install path: C:\Users\chris\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\pydantic
python version: 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) [MSC v.1915 32 bit (Intel)]
platform: Windows-10-10.0.18362-SP0
optional deps. installed: []
```
## Description
My teammates and I debated this for a bit but we're fairly confident that we're experiencing a bug, though it could just be a misunderstanding of how the translation to OpenAPI schema is intended to happen. We can at least say that we couldn't find any other issues on this github addressing it or samples in the docs about our case.
Specifically, when we run the following sample:
```
from pydantic import BaseModel, Field
from typing import Union
from pprint import pprint
class TestClassA(BaseModel):
pass
class TestClassB(BaseModel):
pass
class TestClassC(BaseModel):
a: Union[TestClassA, TestClassB]
pprint(TestClassC.schema())
```
... we get the expected result:
```
{'definitions': {'TestClassA': {'properties': {},
'title': 'TestClassA',
'type': 'object'},
'TestClassB': {'properties': {},
'title': 'TestClassB',
'type': 'object'}},
'properties': {'a': {'anyOf': [{'$ref': '#/definitions/TestClassA'},
{'$ref': '#/definitions/TestClassB'}],
'title': 'A'}},
'required': ['a'],
'title': 'TestClassC',
'type': 'object'}
```
However, when we change `TestClassC` to be the following:
```
class TestClassC(BaseModel):
a: Union[TestClassA, TestClassB] = Field(..., description='description...')
```
... we get the following:
```
{'definitions': {'TestClassA': {'properties': {},
'title': 'TestClassA',
'type': 'object'},
'TestClassB': {'properties': {},
'title': 'TestClassB',
'type': 'object'}},
'properties': {'a': {'anyOf': [{'allOf': [{'$ref': '#/definitions/TestClassA'}]},
{'allOf': [{'$ref': '#/definitions/TestClassB'}]}],
'description': 'description...',
'title': 'A'}},
'required': ['a'],
'title': 'TestClassC',
'type': 'object'}
```
Take particular note of the additional `'allOf'` keys under the `'properties'`
We get the same additional `'allOf'` keys if we change `TestClassC` to be the following:
```
class TestClassC(BaseModel):
a: Union[TestClassA, TestClassB] = TestClassA()
```
Right now, we're using a workaround with the `schema_extra` capability to get rid of these extra `allOf` keys but this seemed a bit hacky to us. If these `allOf` keys are the result of a bug, we're happy to provide more test cases that trigger it if that would help. Or, if there's a better way to get rid of it these extra keys that we overlooked, we're happy to help documenting it in any way that we can so others like us don't get confused. Thank you for taking the time to read this issue and for the incredibly useful package!
author:
url:https://github.com/chriswmackey
type:Person
name:chriswmackey
datePublished:2020-02-05T18:58:37.000Z
interactionStatistic:
type:InteractionCounter
interactionType:https://schema.org/CommentAction
userInteractionCount:4
url:https://github.com/1209/pydantic/issues/1209
Person:
url:https://github.com/chriswmackey
name:chriswmackey
url:https://github.com/chriswmackey
name:chriswmackey
InteractionCounter:
interactionType:https://schema.org/CommentAction
userInteractionCount:4
interactionType:https://schema.org/CommentAction
userInteractionCount:4
External Links {π}(2)
Analytics and Tracking {π}
- Site Verification - Google
Libraries {π}
- Clipboard.js
- D3.js
- Lodash
Emails and Hosting {βοΈ}
Mail Servers:
- aspmx.l.google.com
- alt1.aspmx.l.google.com
- alt2.aspmx.l.google.com
- alt3.aspmx.l.google.com
- alt4.aspmx.l.google.com
Name Servers:
- dns1.p08.nsone.net
- dns2.p08.nsone.net
- dns3.p08.nsone.net
- dns4.p08.nsone.net
- ns-1283.awsdns-32.org
- ns-1707.awsdns-21.co.uk
- ns-421.awsdns-52.com
- ns-520.awsdns-01.net