Skip to content

Commit

Permalink
test(gen): add negative tests for default value type check
Browse files Browse the repository at this point in the history
  • Loading branch information
tdakkota committed Apr 25, 2023
1 parent 887ee9b commit 78a8ebf
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 3 deletions.
31 changes: 31 additions & 0 deletions _testdata/negative/wrong_default_type/array_value.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"openapi": "3.0.3",
"info": {
"title": "title",
"version": "v0.1.0"
},
"paths": {
"/foo": {
"get": {
"responses": {
"200": {
"description": "User info",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"not_nullable": {
"type": "integer",
"default": []
}
}
}
}
}
}
}
}
}
}
}
31 changes: 31 additions & 0 deletions _testdata/negative/wrong_default_type/bool_value.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"openapi": "3.0.3",
"info": {
"title": "title",
"version": "v0.1.0"
},
"paths": {
"/foo": {
"get": {
"responses": {
"200": {
"description": "User info",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"not_nullable": {
"type": "integer",
"default": false
}
}
}
}
}
}
}
}
}
}
}
31 changes: 31 additions & 0 deletions _testdata/negative/wrong_default_type/float_value.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"openapi": "3.0.3",
"info": {
"title": "title",
"version": "v0.1.0"
},
"paths": {
"/foo": {
"get": {
"responses": {
"200": {
"description": "User info",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"not_nullable": {
"type": "integer",
"default": 3.14
}
}
}
}
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
"application/json": {
"schema": {
"type": "object",
"required": [
"not_nullable"
],
"properties": {
"not_nullable": {
"type": "integer",
Expand Down
31 changes: 31 additions & 0 deletions _testdata/negative/wrong_default_type/object_value.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"openapi": "3.0.3",
"info": {
"title": "title",
"version": "v0.1.0"
},
"paths": {
"/foo": {
"get": {
"responses": {
"200": {
"description": "User info",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"not_nullable": {
"type": "integer",
"default": {}
}
}
}
}
}
}
}
}
}
}
}
31 changes: 31 additions & 0 deletions _testdata/negative/wrong_default_type/string_value.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"openapi": "3.0.3",
"info": {
"title": "title",
"version": "v0.1.0"
},
"paths": {
"/foo": {
"get": {
"responses": {
"200": {
"description": "User info",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"not_nullable": {
"type": "integer",
"default": "amongus"
}
}
}
}
}
}
}
}
}
}
}

0 comments on commit 78a8ebf

Please sign in to comment.