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

[Python-experimental] JSON schema 'null' type should be modeled as 'none_type' #6121

Merged
merged 61 commits into from
May 13, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
489985d
Handle null type
sebastien-rosset Apr 30, 2020
c16089e
Handle null type
sebastien-rosset Apr 30, 2020
26865b3
Handle null type. Add 'null' type in the OAS document for testing pur…
sebastien-rosset Apr 30, 2020
48c310e
Handle null type. Add 'null' type in the OAS document for testing pur…
sebastien-rosset Apr 30, 2020
fddb63b
Handle null type. Add 'null' type in the OAS document for testing pur…
sebastien-rosset Apr 30, 2020
cf4e9f8
Handle null type. Add 'null' type in the OAS document for testing pur…
sebastien-rosset Apr 30, 2020
3b59b47
Handle null type. Add 'null' type in the OAS document for testing pur…
sebastien-rosset May 1, 2020
b362f92
Handle null type. Add 'null' type in the OAS document for testing pur…
sebastien-rosset May 1, 2020
ae93643
improve documentation
sebastien-rosset May 1, 2020
f5acfba
Handle 'null' type
sebastien-rosset May 1, 2020
6ba1523
Handle 'null' type. Add unit tests
sebastien-rosset May 1, 2020
de13169
Merge branch 'master' of github.com:CiscoM31/openapi-generator into p…
sebastien-rosset May 1, 2020
2a6a87a
Add NullType for go
sebastien-rosset May 2, 2020
86bc4c0
Add NullType for go
sebastien-rosset May 2, 2020
6b9c0ce
fix modeling of AnyType for go-experimental
sebastien-rosset May 2, 2020
b0d221e
Merge branch 'master' of github.com:CiscoM31/openapi-generator into p…
sebastien-rosset May 2, 2020
a302894
execute scripts in bin directory
sebastien-rosset May 3, 2020
e449c82
resolve merge conflicts
sebastien-rosset May 3, 2020
043f247
Merge branch 'master' of github.com:CiscoM31/openapi-generator into p…
sebastien-rosset May 4, 2020
1e14c94
Add review comments
sebastien-rosset May 4, 2020
747803e
Add 'null' type in oneOf
sebastien-rosset May 4, 2020
aa06a89
Improve OAS YAML file for golang openapi3 samples
sebastien-rosset May 4, 2020
543d406
'Any type' includes the null value, so 'isNullable' should be set to …
sebastien-rosset May 4, 2020
81093c7
'Any type' includes the null value, so 'isNullable' should be set to …
sebastien-rosset May 4, 2020
9a54ea1
Handle AnyType and NullType
sebastien-rosset May 5, 2020
dc7a7e0
handle anytype for go-experimental
sebastien-rosset May 5, 2020
ddc810c
Merge branch 'master' of github.com:CiscoM31/openapi-generator into p…
sebastien-rosset May 5, 2020
03ec914
Log warning instead of error
sebastien-rosset May 5, 2020
bdf3653
anyOf/oneOf
sebastien-rosset May 5, 2020
9dbae45
Change x-golang-is-container extension to x-golang-has-wrapper
sebastien-rosset May 5, 2020
e1417ec
Add code comments
sebastien-rosset May 5, 2020
480ecbe
Handle Object and any type
sebastien-rosset May 5, 2020
a58f121
Handle Object and any type
sebastien-rosset May 5, 2020
01ff36e
Handle object and any type
sebastien-rosset May 5, 2020
ec97db3
add code comments
sebastien-rosset May 6, 2020
431356c
handle additional properties
sebastien-rosset May 6, 2020
93752ff
handle additional properties
sebastien-rosset May 6, 2020
261dbcd
handle additional properties
sebastien-rosset May 6, 2020
aa6b6df
handle anytype and objecttype for go-exerimental
sebastien-rosset May 6, 2020
90c0c9e
Move golang changes to a separate branch
sebastien-rosset May 7, 2020
f56c812
Move golang changes to a separate branch
sebastien-rosset May 7, 2020
b159356
Better names for the OAS document test properties
sebastien-rosset May 7, 2020
ef5149e
Move golang changes to a separate branch
sebastien-rosset May 7, 2020
84162be
Run samples scripts
sebastien-rosset May 7, 2020
ee786cb
Run samples scripts
sebastien-rosset May 7, 2020
058694b
Merge branch 'master' of github.com:CiscoM31/openapi-generator into p…
sebastien-rosset May 7, 2020
82cb0e9
fix unit test issues
sebastien-rosset May 8, 2020
2c5c1cf
Handle none type
sebastien-rosset May 8, 2020
0694f83
Merge branch 'master' of github.com:CiscoM31/openapi-generator into p…
sebastien-rosset May 8, 2020
b6afbc6
Merge branch 'master' of github.com:CiscoM31/openapi-generator into p…
sebastien-rosset May 8, 2020
f275dc9
Fix index out of range exception
sebastien-rosset May 8, 2020
93cc8c8
fix formatting issues
sebastien-rosset May 8, 2020
6939648
fix formatting issues
sebastien-rosset May 8, 2020
8bdca05
fix formatting issues. Finally figured out how to check formatting in…
sebastien-rosset May 8, 2020
4c01344
fix formatting issues
sebastien-rosset May 8, 2020
537c28b
resolve merge conflicts
sebastien-rosset May 11, 2020
71d550c
resolve merge conflicts
sebastien-rosset May 11, 2020
11c52e4
resolve merge conflicts
sebastien-rosset May 12, 2020
e16c24e
Merge branch 'master' of github.com:CiscoM31/openapi-generator into p…
sebastien-rosset May 12, 2020
8f1c202
Merge branch 'master' of github.com:CiscoM31/openapi-generator into p…
sebastien-rosset May 12, 2020
5e48c72
run samples scripts
sebastien-rosset May 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public PythonClientCodegen() {
// map uuid to string for the time being
typeMapping.put("UUID", "str");
typeMapping.put("URI", "str");
typeMapping.put("null", "none_type");

// from https://docs.python.org/3/reference/lexical_analysis.html#keywords
setReservedWordsLowerCase(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1855,6 +1855,7 @@ components:
- $ref: '#/components/schemas/banana'
fruitReq:
oneOf:
- type: 'null'
sebastien-rosset marked this conversation as resolved.
Show resolved Hide resolved
- $ref: '#/components/schemas/appleReq'
- $ref: '#/components/schemas/bananaReq'
appleReq:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1973,6 +1973,7 @@ components:
type: string
fruitReq:
oneOf:
- type: "null"
spacether marked this conversation as resolved.
Show resolved Hide resolved
- $ref: '#/components/schemas/appleReq'
- $ref: '#/components/schemas/bananaReq'
x-one-of-name: FruitReq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ func (s *FruitReq) UnmarshalJSON(src []byte) error {
s.FruitReqInterface = unmarshaledBananaReq
return nil
}
var unmarshaledNull *Null = &Null{}
err = json.Unmarshal(src, unmarshaledNull)
if err == nil {
s.FruitReqInterface = unmarshaledNull
return nil
}
return fmt.Errorf("No oneOf model could be deserialized from payload: %s", string(src))
}
type NullableFruitReq struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
except ImportError:
banana_req = sys.modules[
'petstore_api.models.banana_req']
try:
sebastien-rosset marked this conversation as resolved.
Show resolved Hide resolved
from petstore_api.models import none_type
except ImportError:
none_type = sys.modules[
'petstore_api.models.none_type']


class FruitReq(ModelComposed):
Expand Down Expand Up @@ -196,5 +201,6 @@ def _composed_schemas():
'oneOf': [
apple_req.AppleReq,
banana_req.BananaReq,
none_type,
],
}