From 0d70bcb4ebdc6ccac829d8a13fc13c7fcc4aa89a Mon Sep 17 00:00:00 2001 From: p1c2u Date: Thu, 5 Oct 2023 15:54:54 +0000 Subject: [PATCH] Read-only write-only spec test --- poetry.lock | 14 +++---- .../data/v3.0/read-only-write-only.yaml | 42 +++++++++++++++++++ .../integration/validation/test_validators.py | 1 + 3 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 tests/integration/data/v3.0/read-only-write-only.yaml diff --git a/poetry.lock b/poetry.lock index 590b2d2..06fa17d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -579,13 +579,13 @@ i18n = ["Babel (>=2.7)"] [[package]] name = "jsonschema" -version = "4.19.0" +version = "4.19.1" description = "An implementation of JSON Schema validation for Python" optional = false python-versions = ">=3.8" files = [ - {file = "jsonschema-4.19.0-py3-none-any.whl", hash = "sha256:043dc26a3845ff09d20e4420d6012a9c91c9aa8999fa184e7efcfeccb41e32cb"}, - {file = "jsonschema-4.19.0.tar.gz", hash = "sha256:6e1e7569ac13be8139b2dd2c21a55d350066ee3f80df06c608b398cdc6f30e8f"}, + {file = "jsonschema-4.19.1-py3-none-any.whl", hash = "sha256:cd5f1f9ed9444e554b38ba003af06c0a8c2868131e56bfbef0550fb450c0330e"}, + {file = "jsonschema-4.19.1.tar.gz", hash = "sha256:ec84cc37cfa703ef7cd4928db24f9cb31428a5d0fa77747b8b51a847458e0bbf"}, ] [package.dependencies] @@ -830,17 +830,17 @@ setuptools = "*" [[package]] name = "openapi-schema-validator" -version = "0.6.0" +version = "0.6.2" description = "OpenAPI schema validation for Python" optional = false python-versions = ">=3.8.0,<4.0.0" files = [ - {file = "openapi_schema_validator-0.6.0-py3-none-any.whl", hash = "sha256:9e95b95b621efec5936245025df0d6a7ffacd1551e91d09196b3053040c931d7"}, - {file = "openapi_schema_validator-0.6.0.tar.gz", hash = "sha256:921b7c1144b856ca3813e41ecff98a4050f7611824dfc5c6ead7072636af0520"}, + {file = "openapi_schema_validator-0.6.2-py3-none-any.whl", hash = "sha256:c4887c1347c669eb7cded9090f4438b710845cd0f90d1fb9e1b3303fb37339f8"}, + {file = "openapi_schema_validator-0.6.2.tar.gz", hash = "sha256:11a95c9c9017912964e3e5f2545a5b11c3814880681fcacfb73b1759bb4f2804"}, ] [package.dependencies] -jsonschema = ">=4.18.0,<5.0.0" +jsonschema = ">=4.19.1,<5.0.0" jsonschema-specifications = ">=2023.5.2,<2024.0.0" rfc3339-validator = "*" diff --git a/tests/integration/data/v3.0/read-only-write-only.yaml b/tests/integration/data/v3.0/read-only-write-only.yaml new file mode 100644 index 0000000..9af8465 --- /dev/null +++ b/tests/integration/data/v3.0/read-only-write-only.yaml @@ -0,0 +1,42 @@ +openapi: "3.0.0" +info: + title: Specification Containing readOnly + version: "0.1" +paths: + /users: + post: + operationId: createUser + requestBody: + description: Post data for creating a user + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/User' + responses: + default: + description: Create a user + content: + application/json: + schema: + $ref: '#/components/schemas/User' +components: + schemas: + User: + x-model: User + type: object + required: + - id + - name + properties: + id: + type: integer + format: int32 + readOnly: true + default: 1 + name: + type: string + hidden: + type: boolean + writeOnly: true + default: true \ No newline at end of file diff --git a/tests/integration/validation/test_validators.py b/tests/integration/validation/test_validators.py index 5eacfd2..aef830b 100644 --- a/tests/integration/validation/test_validators.py +++ b/tests/integration/validation/test_validators.py @@ -65,6 +65,7 @@ def local_test_suite_file_path(self, test_file): "petstore-separate/spec/openapi.yaml", "parent-reference/openapi.yaml", "property-recursive.yaml", + "read-only-write-only.yaml", ], ) def test_valid(self, factory, validator_v30, spec_file):