diff --git a/src/Support/Generator/TypeTransformer.php b/src/Support/Generator/TypeTransformer.php index 28ad5055b..e02ab802d 100644 --- a/src/Support/Generator/TypeTransformer.php +++ b/src/Support/Generator/TypeTransformer.php @@ -222,11 +222,11 @@ public function transform(Type $type): OpenApiType $openApiType = count($uniqueItems) === 1 ? $uniqueItems[0] : (new AnyOf)->setItems($uniqueItems); } } elseif ($type instanceof LiteralStringType) { - $openApiType = (new StringType)->enum([$type->value]); + $openApiType = (new StringType)->constant($type->value); } elseif ($type instanceof LiteralIntegerType) { - $openApiType = (new IntegerType)->enum([$type->value]); + $openApiType = (new IntegerType)->constant($type->value); } elseif ($type instanceof LiteralFloatType) { - $openApiType = (new NumberType)->enum([$type->value]); + $openApiType = (new NumberType)->constant($type->value); } elseif ($type instanceof \Dedoc\Scramble\Support\Type\StringType) { $openApiType = new StringType; } elseif ($type instanceof \Dedoc\Scramble\Support\Type\FloatType) { diff --git a/src/Support/Generator/Types/Type.php b/src/Support/Generator/Types/Type.php index 8416fd18f..20d750f05 100644 --- a/src/Support/Generator/Types/Type.php +++ b/src/Support/Generator/Types/Type.php @@ -32,6 +32,9 @@ abstract class Type public array $enum = []; + /** @var scalar|null */ + public $constant = null; + public bool $nullable = false; public bool $deprecated = false; @@ -113,6 +116,7 @@ public function toArray() 'deprecated' => $this->deprecated, 'pattern' => $this->pattern, 'enum' => count($this->enum) ? $this->enum : null, + 'const' => ! is_null($this->constant) ? $this->constant : null, ]), $this->example instanceof MissingValue ? [] : ['example' => $this->example], $this->default instanceof MissingValue ? [] : ['default' => $this->default], @@ -146,6 +150,17 @@ public function enum(array $enum): self return $this; } + /** + * @param scalar $constant + * @return $this + */ + public function constant($constant): self + { + $this->constant = $constant; + + return $this; + } + /** * @param array|scalar|null|MissingValue $example * @return $this diff --git a/tests/InferExtensions/JsonResourceExtensionTest.php b/tests/InferExtensions/JsonResourceExtensionTest.php index c0c59c49e..fd5e95399 100644 --- a/tests/InferExtensions/JsonResourceExtensionTest.php +++ b/tests/InferExtensions/JsonResourceExtensionTest.php @@ -50,7 +50,7 @@ function JsonResourceExtensionTest_analyze(Infer $infer, OpenApiContext $context ], 'value' => [ 'type' => 'integer', - 'enum' => [42], + 'const' => 42, ], 'default' => [ 'anyOf' => [ diff --git a/tests/ResourceCollectionResponseTest.php b/tests/ResourceCollectionResponseTest.php index 15f0280a2..569b4a07a 100644 --- a/tests/ResourceCollectionResponseTest.php +++ b/tests/ResourceCollectionResponseTest.php @@ -142,7 +142,7 @@ public function index(Request $request) expect($props = $openApiDocument['paths']['/test']['get']['responses'][200]['content']['application/json']['schema']['properties']) ->toHaveKeys(['data', 'something']) ->and($props['something']['properties']) - ->toBe(['foo' => ['type' => 'string', 'enum' => ['bar']]]); + ->toBe(['foo' => ['type' => 'string', 'const' => 'bar']]); }); class AnnotationResourceCollectionResponseTest_Controller { diff --git a/tests/Support/OperationExtensions/ResponseExtensionTest.php b/tests/Support/OperationExtensions/ResponseExtensionTest.php index 96aa793b2..244f9b15c 100644 --- a/tests/Support/OperationExtensions/ResponseExtensionTest.php +++ b/tests/Support/OperationExtensions/ResponseExtensionTest.php @@ -12,7 +12,7 @@ expect($openApiDocument['paths']['/test']['get']['responses'][200]['content']['application/json']['schema']) ->toHaveKey('type', 'object') ->toHaveKey('properties.foo.type', 'string') - ->toHaveKey('properties.foo.enum', ['bar']); + ->toHaveKey('properties.foo.const', 'bar'); }); class Foo_ResponseExtensionTest_Controller { @@ -55,7 +55,7 @@ public function foo(): int 'schema' => [ 'type' => 'object', 'properties' => [ - 'foo' => ['type' => 'string', 'enum' => ['bar']], + 'foo' => ['type' => 'string', 'const' => 'bar'], ], 'required' => ['foo'], ], diff --git a/tests/Support/OperationExtensions/RulesExtractor/RuleSetToSchemaTransformersTest.php b/tests/Support/OperationExtensions/RulesExtractor/RuleSetToSchemaTransformersTest.php index ba4e41afb..69b1da57b 100644 --- a/tests/Support/OperationExtensions/RulesExtractor/RuleSetToSchemaTransformersTest.php +++ b/tests/Support/OperationExtensions/RulesExtractor/RuleSetToSchemaTransformersTest.php @@ -49,7 +49,7 @@ expect($schema->toArray()) ->toBe([ 'type' => 'string', - 'enum' => ['foo'], + 'const' => 'foo', ]); })->skip(! method_exists(Enum::class, 'only')); @@ -65,7 +65,7 @@ expect($schema->toArray()) ->toBe([ 'type' => 'string', - 'enum' => ['bar'], + 'const' => 'bar', ]); })->skip(! method_exists(Enum::class, 'except')); }); diff --git a/tests/Support/Type/OffsetSetTest.php b/tests/Support/Type/OffsetSetTest.php index fe2f03e76..15a448988 100644 --- a/tests/Support/Type/OffsetSetTest.php +++ b/tests/Support/Type/OffsetSetTest.php @@ -153,7 +153,7 @@ public function setC($data) 'bar' => [ 'type' => 'integer', 'description' => 'Foo description.', - 'enum' => [42], + 'const' => 42, ], ], 'required' => ['bar'], @@ -186,7 +186,7 @@ public function setC($data) 'bar' => [ 'type' => 'integer', 'description' => 'Foo description.', - 'enum' => [42], + 'const' => 42, ], ], 'required' => ['bar'], diff --git a/tests/Support/TypeToSchemaExtensions/ArrayableToSchemaTest.php b/tests/Support/TypeToSchemaExtensions/ArrayableToSchemaTest.php index 0d98b4a22..80907a1fa 100644 --- a/tests/Support/TypeToSchemaExtensions/ArrayableToSchemaTest.php +++ b/tests/Support/TypeToSchemaExtensions/ArrayableToSchemaTest.php @@ -31,7 +31,7 @@ 'properties' => [ 'id' => [ 'type' => 'integer', - 'enum' => [42], + 'const' => 42, ], ], 'required' => ['id'], diff --git a/tests/Support/TypeToSchemaExtensions/JsonResourceTypeToSchemaTest.php b/tests/Support/TypeToSchemaExtensions/JsonResourceTypeToSchemaTest.php index b3904080b..655dc5511 100644 --- a/tests/Support/TypeToSchemaExtensions/JsonResourceTypeToSchemaTest.php +++ b/tests/Support/TypeToSchemaExtensions/JsonResourceTypeToSchemaTest.php @@ -56,8 +56,8 @@ 'properties' => [ 'id' => ['type' => 'integer'], 'name' => ['type' => 'string'], - 'foo' => ['type' => 'string', 'enum' => ['bar']], - 'nested' => ['type' => 'string', 'enum' => ['true']], + 'foo' => ['type' => 'string', 'const' => 'bar'], + 'nested' => ['type' => 'string', 'const' => 'true'], ], 'required' => ['id', 'name', 'foo', 'nested'], ]], @@ -74,7 +74,7 @@ 'properties' => [ 'id' => ['type' => 'integer'], 'name' => ['type' => 'string'], - 'foo' => ['type' => 'string', 'enum' => ['bar']], + 'foo' => ['type' => 'string', 'const' => 'bar'], ], 'required' => ['id', 'name', 'foo'], ]], @@ -263,7 +263,7 @@ public function toArray(Request $request) ->and($responses['202']['content']['application/json']['schema']['properties']['meta']) ->toBe([ 'type' => 'object', - 'properties' => ['foo' => ['type' => 'string', 'enum' => ['bar']]], + 'properties' => ['foo' => ['type' => 'string', 'const' => 'bar']], 'required' => ['foo'], ]); }); diff --git a/tests/Support/TypeToSchemaExtensions/StreamedResponseToSchemaTest.php b/tests/Support/TypeToSchemaExtensions/StreamedResponseToSchemaTest.php index a9d3e1d51..e328e7a58 100644 --- a/tests/Support/TypeToSchemaExtensions/StreamedResponseToSchemaTest.php +++ b/tests/Support/TypeToSchemaExtensions/StreamedResponseToSchemaTest.php @@ -29,7 +29,7 @@ 'application/json' => [ 'schema' => [ 'type' => 'object', - 'properties' => ['foo' => ['type' => 'string', 'enum' => ['bar']]], + 'properties' => ['foo' => ['type' => 'string', 'const' => 'bar']], 'required' => ['foo'], ], ], diff --git a/tests/TypeToSchemaTransformerTest.php b/tests/TypeToSchemaTransformerTest.php index 4c24ad8f2..313020135 100644 --- a/tests/TypeToSchemaTransformerTest.php +++ b/tests/TypeToSchemaTransformerTest.php @@ -38,8 +38,8 @@ })->with([ [new IntegerType, ['type' => 'integer']], [new StringType, ['type' => 'string']], - [new LiteralStringType('wow'), ['type' => 'string', 'enum' => ['wow']]], - [new LiteralFloatType(157.50), ['type' => 'number', 'enum' => [157.5]]], + [new LiteralStringType('wow'), ['type' => 'string', 'const' => 'wow']], + [new LiteralFloatType(157.50), ['type' => 'number', 'const' => 157.5]], [new BooleanType, ['type' => 'boolean']], [new MixedType, (object) []], [new ArrayType(value: new StringType), ['type' => 'array', 'items' => ['type' => 'string']]], diff --git a/tests/__snapshots__/ResourceCollectionResponseTest__it_attaches_additional_data_to_the_response_documentation__1.yml b/tests/__snapshots__/ResourceCollectionResponseTest__it_attaches_additional_data_to_the_response_documentation__1.yml index ebea0ac45..ff65e2251 100644 --- a/tests/__snapshots__/ResourceCollectionResponseTest__it_attaches_additional_data_to_the_response_documentation__1.yml +++ b/tests/__snapshots__/ResourceCollectionResponseTest__it_attaches_additional_data_to_the_response_documentation__1.yml @@ -5,6 +5,6 @@ info: servers: - { url: 'http://localhost/api' } paths: - /test: { get: { operationId: resourceCollectionResponseTest.index, tags: [ResourceCollectionResponseTest_], responses: { 200: { description: '`UserCollection_One`', content: { application/json: { schema: { type: object, properties: { data: { $ref: '#/components/schemas/UserCollection_One' }, something: { type: object, properties: { foo: { type: string, enum: [bar] } }, required: [foo] } }, required: [data, something] } } } } } } } + /test: { get: { operationId: resourceCollectionResponseTest.index, tags: [ResourceCollectionResponseTest_], responses: { 200: { description: '`UserCollection_One`', content: { application/json: { schema: { type: object, properties: { data: { $ref: '#/components/schemas/UserCollection_One' }, something: { type: object, properties: { foo: { type: string, const: bar } }, required: [foo] } }, required: [data, something] } } } } } } } components: - schemas: { UserCollection_One: { type: object, properties: { foo: { type: string, enum: [bar] }, users: { type: array, items: { $ref: '#/components/schemas/UserResource' } }, meta: { type: object, properties: { foo: { type: string, enum: [bar] } }, required: [foo] } }, required: [foo, users, meta], title: UserCollection_One }, UserResource: { type: object, properties: { id: { type: integer, enum: [1] } }, required: [id], title: UserResource } } + schemas: { UserCollection_One: { type: object, properties: { foo: { type: string, const: bar }, users: { type: array, items: { $ref: '#/components/schemas/UserResource' } }, meta: { type: object, properties: { foo: { type: string, const: bar } }, required: [foo] } }, required: [foo, users, meta], title: UserCollection_One }, UserResource: { type: object, properties: { id: { type: integer, const: 1 } }, required: [id], title: UserResource } } diff --git a/tests/__snapshots__/ResourceCollectionResponseTest__it_attaches_additional_data_to_the_response_documentation__2.yml b/tests/__snapshots__/ResourceCollectionResponseTest__it_attaches_additional_data_to_the_response_documentation__2.yml index ebea0ac45..ff65e2251 100644 --- a/tests/__snapshots__/ResourceCollectionResponseTest__it_attaches_additional_data_to_the_response_documentation__2.yml +++ b/tests/__snapshots__/ResourceCollectionResponseTest__it_attaches_additional_data_to_the_response_documentation__2.yml @@ -5,6 +5,6 @@ info: servers: - { url: 'http://localhost/api' } paths: - /test: { get: { operationId: resourceCollectionResponseTest.index, tags: [ResourceCollectionResponseTest_], responses: { 200: { description: '`UserCollection_One`', content: { application/json: { schema: { type: object, properties: { data: { $ref: '#/components/schemas/UserCollection_One' }, something: { type: object, properties: { foo: { type: string, enum: [bar] } }, required: [foo] } }, required: [data, something] } } } } } } } + /test: { get: { operationId: resourceCollectionResponseTest.index, tags: [ResourceCollectionResponseTest_], responses: { 200: { description: '`UserCollection_One`', content: { application/json: { schema: { type: object, properties: { data: { $ref: '#/components/schemas/UserCollection_One' }, something: { type: object, properties: { foo: { type: string, const: bar } }, required: [foo] } }, required: [data, something] } } } } } } } components: - schemas: { UserCollection_One: { type: object, properties: { foo: { type: string, enum: [bar] }, users: { type: array, items: { $ref: '#/components/schemas/UserResource' } }, meta: { type: object, properties: { foo: { type: string, enum: [bar] } }, required: [foo] } }, required: [foo, users, meta], title: UserCollection_One }, UserResource: { type: object, properties: { id: { type: integer, enum: [1] } }, required: [id], title: UserResource } } + schemas: { UserCollection_One: { type: object, properties: { foo: { type: string, const: bar }, users: { type: array, items: { $ref: '#/components/schemas/UserResource' } }, meta: { type: object, properties: { foo: { type: string, const: bar } }, required: [foo] } }, required: [foo, users, meta], title: UserCollection_One }, UserResource: { type: object, properties: { id: { type: integer, const: 1 } }, required: [id], title: UserResource } } diff --git a/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_paginationInformation_implementation__1.yml b/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_paginationInformation_implementation__1.yml index 2f27880d2..706fc74ca 100644 --- a/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_paginationInformation_implementation__1.yml +++ b/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_paginationInformation_implementation__1.yml @@ -1,3 +1,3 @@ description: 'Paginated set of `UserResource`' content: - application/json: { schema: { type: object, properties: { data: { $ref: '#/components/schemas/UserCollection_Five' }, links: { type: object, properties: { first: { type: [string, 'null'] }, last: { type: [string, 'null'] }, prev: { type: [string, 'null'] }, next: { type: [string, 'null'] }, custom: { type: string, enum: ['https://example.com'] } }, required: [first, last, prev, next, custom] }, meta: { type: object, properties: { current_page: { type: integer, minimum: 1 }, from: { type: [integer, 'null'], minimum: 1 }, last_page: { type: integer, minimum: 1 }, links: { type: array, description: 'Generated paginator links.', items: { type: object, properties: { url: { type: [string, 'null'] }, label: { type: string }, active: { type: boolean } }, required: [url, label, active] } }, path: { type: [string, 'null'], description: 'Base path for paginator generated URLs.' }, per_page: { type: integer, description: 'Number of items shown per page.', minimum: 0 }, to: { type: [integer, 'null'], description: 'Number of the last item in the slice.', minimum: 1 }, total: { type: integer, description: 'Total number of items being paginated.', minimum: 0 } }, required: [current_page, from, last_page, links, path, per_page, to, total] } }, required: [data, links, meta] } } + application/json: { schema: { type: object, properties: { data: { $ref: '#/components/schemas/UserCollection_Five' }, links: { type: object, properties: { first: { type: [string, 'null'] }, last: { type: [string, 'null'] }, prev: { type: [string, 'null'] }, next: { type: [string, 'null'] }, custom: { type: string, const: 'https://example.com' } }, required: [first, last, prev, next, custom] }, meta: { type: object, properties: { current_page: { type: integer, minimum: 1 }, from: { type: [integer, 'null'], minimum: 1 }, last_page: { type: integer, minimum: 1 }, links: { type: array, description: 'Generated paginator links.', items: { type: object, properties: { url: { type: [string, 'null'] }, label: { type: string }, active: { type: boolean } }, required: [url, label, active] } }, path: { type: [string, 'null'], description: 'Base path for paginator generated URLs.' }, per_page: { type: integer, description: 'Number of items shown per page.', minimum: 0 }, to: { type: [integer, 'null'], description: 'Number of the last item in the slice.', minimum: 1 }, total: { type: integer, description: 'Total number of items being paginated.', minimum: 0 } }, required: [current_page, from, last_page, links, path, per_page, to, total] } }, required: [data, links, meta] } } diff --git a/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_paginationInformation_implementation__2.yml b/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_paginationInformation_implementation__2.yml index 2f27880d2..706fc74ca 100644 --- a/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_paginationInformation_implementation__2.yml +++ b/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_paginationInformation_implementation__2.yml @@ -1,3 +1,3 @@ description: 'Paginated set of `UserResource`' content: - application/json: { schema: { type: object, properties: { data: { $ref: '#/components/schemas/UserCollection_Five' }, links: { type: object, properties: { first: { type: [string, 'null'] }, last: { type: [string, 'null'] }, prev: { type: [string, 'null'] }, next: { type: [string, 'null'] }, custom: { type: string, enum: ['https://example.com'] } }, required: [first, last, prev, next, custom] }, meta: { type: object, properties: { current_page: { type: integer, minimum: 1 }, from: { type: [integer, 'null'], minimum: 1 }, last_page: { type: integer, minimum: 1 }, links: { type: array, description: 'Generated paginator links.', items: { type: object, properties: { url: { type: [string, 'null'] }, label: { type: string }, active: { type: boolean } }, required: [url, label, active] } }, path: { type: [string, 'null'], description: 'Base path for paginator generated URLs.' }, per_page: { type: integer, description: 'Number of items shown per page.', minimum: 0 }, to: { type: [integer, 'null'], description: 'Number of the last item in the slice.', minimum: 1 }, total: { type: integer, description: 'Total number of items being paginated.', minimum: 0 } }, required: [current_page, from, last_page, links, path, per_page, to, total] } }, required: [data, links, meta] } } + application/json: { schema: { type: object, properties: { data: { $ref: '#/components/schemas/UserCollection_Five' }, links: { type: object, properties: { first: { type: [string, 'null'] }, last: { type: [string, 'null'] }, prev: { type: [string, 'null'] }, next: { type: [string, 'null'] }, custom: { type: string, const: 'https://example.com' } }, required: [first, last, prev, next, custom] }, meta: { type: object, properties: { current_page: { type: integer, minimum: 1 }, from: { type: [integer, 'null'], minimum: 1 }, last_page: { type: integer, minimum: 1 }, links: { type: array, description: 'Generated paginator links.', items: { type: object, properties: { url: { type: [string, 'null'] }, label: { type: string }, active: { type: boolean } }, required: [url, label, active] } }, path: { type: [string, 'null'], description: 'Base path for paginator generated URLs.' }, per_page: { type: integer, description: 'Number of items shown per page.', minimum: 0 }, to: { type: [integer, 'null'], description: 'Number of the last item in the slice.', minimum: 1 }, total: { type: integer, description: 'Total number of items being paginated.', minimum: 0 } }, required: [current_page, from, last_page, links, path, per_page, to, total] } }, required: [data, links, meta] } } diff --git a/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_toArray_and_with__1.yml b/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_toArray_and_with__1.yml index 2143dad61..c3601d2ae 100644 --- a/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_toArray_and_with__1.yml +++ b/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_toArray_and_with__1.yml @@ -1,8 +1,8 @@ type: object properties: - foo: { type: string, enum: [bar] } + foo: { type: string, const: bar } users: { type: array, items: { $ref: '#/components/schemas/UserResource' } } - meta: { type: object, properties: { foo: { type: string, enum: [bar] } }, required: [foo] } + meta: { type: object, properties: { foo: { type: string, const: bar } }, required: [foo] } required: - foo - users diff --git a/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_toArray_and_with__2.yml b/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_toArray_and_with__2.yml index 2143dad61..c3601d2ae 100644 --- a/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_toArray_and_with__2.yml +++ b/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_toArray_and_with__2.yml @@ -1,8 +1,8 @@ type: object properties: - foo: { type: string, enum: [bar] } + foo: { type: string, const: bar } users: { type: array, items: { $ref: '#/components/schemas/UserResource' } } - meta: { type: object, properties: { foo: { type: string, enum: [bar] } }, required: [foo] } + meta: { type: object, properties: { foo: { type: string, const: bar } }, required: [foo] } required: - foo - users diff --git a/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_toArray_only__1.yml b/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_toArray_only__1.yml index 2143dad61..c3601d2ae 100644 --- a/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_toArray_only__1.yml +++ b/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_toArray_only__1.yml @@ -1,8 +1,8 @@ type: object properties: - foo: { type: string, enum: [bar] } + foo: { type: string, const: bar } users: { type: array, items: { $ref: '#/components/schemas/UserResource' } } - meta: { type: object, properties: { foo: { type: string, enum: [bar] } }, required: [foo] } + meta: { type: object, properties: { foo: { type: string, const: bar } }, required: [foo] } required: - foo - users diff --git a/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_toArray_only__2.yml b/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_toArray_only__2.yml index 2143dad61..c3601d2ae 100644 --- a/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_toArray_only__2.yml +++ b/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_with_toArray_only__2.yml @@ -1,8 +1,8 @@ type: object properties: - foo: { type: string, enum: [bar] } + foo: { type: string, const: bar } users: { type: array, items: { $ref: '#/components/schemas/UserResource' } } - meta: { type: object, properties: { foo: { type: string, enum: [bar] } }, required: [foo] } + meta: { type: object, properties: { foo: { type: string, const: bar } }, required: [foo] } required: - foo - users diff --git a/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_without_proper_toArray_implementation__1.yml b/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_without_proper_toArray_implementation__1.yml index b0380fe67..7f8cdc09f 100644 --- a/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_without_proper_toArray_implementation__1.yml +++ b/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_without_proper_toArray_implementation__1.yml @@ -2,4 +2,4 @@ response: description: '`UserCollection_Three`' content: { application/json: { schema: { type: object, properties: { data: { $ref: '#/components/schemas/UserCollection_Three' } }, required: [data] } } } components: - schemas: { UserCollection_Three: { type: array, items: { $ref: '#/components/schemas/UserResource' }, title: UserCollection_Three }, UserResource: { type: object, properties: { id: { type: integer, enum: [1] } }, required: [id], title: UserResource } } + schemas: { UserCollection_Three: { type: array, items: { $ref: '#/components/schemas/UserResource' }, title: UserCollection_Three }, UserResource: { type: object, properties: { id: { type: integer, const: 1 } }, required: [id], title: UserResource } } diff --git a/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_without_proper_toArray_implementation__2.yml b/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_without_proper_toArray_implementation__2.yml index b0380fe67..7f8cdc09f 100644 --- a/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_without_proper_toArray_implementation__2.yml +++ b/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_without_proper_toArray_implementation__2.yml @@ -2,4 +2,4 @@ response: description: '`UserCollection_Three`' content: { application/json: { schema: { type: object, properties: { data: { $ref: '#/components/schemas/UserCollection_Three' } }, required: [data] } } } components: - schemas: { UserCollection_Three: { type: array, items: { $ref: '#/components/schemas/UserResource' }, title: UserCollection_Three }, UserResource: { type: object, properties: { id: { type: integer, enum: [1] } }, required: [id], title: UserResource } } + schemas: { UserCollection_Three: { type: array, items: { $ref: '#/components/schemas/UserResource' }, title: UserCollection_Three }, UserResource: { type: object, properties: { id: { type: integer, const: 1 } }, required: [id], title: UserResource } } diff --git a/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_without_toArray_implementation__1.yml b/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_without_toArray_implementation__1.yml index 062e1d82c..46fe4f377 100644 --- a/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_without_toArray_implementation__1.yml +++ b/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_without_toArray_implementation__1.yml @@ -2,4 +2,4 @@ response: description: '`UserCollection_Four`' content: { application/json: { schema: { type: object, properties: { data: { $ref: '#/components/schemas/UserCollection_Four' } }, required: [data] } } } components: - schemas: { UserCollection_Four: { type: array, items: { $ref: '#/components/schemas/UserResource' }, title: UserCollection_Four }, UserResource: { type: object, properties: { id: { type: integer, enum: [1] } }, required: [id], title: UserResource } } + schemas: { UserCollection_Four: { type: array, items: { $ref: '#/components/schemas/UserResource' }, title: UserCollection_Four }, UserResource: { type: object, properties: { id: { type: integer, const: 1 } }, required: [id], title: UserResource } } diff --git a/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_without_toArray_implementation__2.yml b/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_without_toArray_implementation__2.yml index 062e1d82c..46fe4f377 100644 --- a/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_without_toArray_implementation__2.yml +++ b/tests/__snapshots__/ResourceCollectionResponseTest__transforms_collection_without_toArray_implementation__2.yml @@ -2,4 +2,4 @@ response: description: '`UserCollection_Four`' content: { application/json: { schema: { type: object, properties: { data: { $ref: '#/components/schemas/UserCollection_Four' } }, required: [data] } } } components: - schemas: { UserCollection_Four: { type: array, items: { $ref: '#/components/schemas/UserResource' }, title: UserCollection_Four }, UserResource: { type: object, properties: { id: { type: integer, enum: [1] } }, required: [id], title: UserResource } } + schemas: { UserCollection_Four: { type: array, items: { $ref: '#/components/schemas/UserResource' }, title: UserCollection_Four }, UserResource: { type: object, properties: { id: { type: integer, const: 1 } }, required: [id], title: UserResource } } diff --git a/tests/__snapshots__/ResponseDocumentingTest__manually_annotated_responses_support__1.yml b/tests/__snapshots__/ResponseDocumentingTest__manually_annotated_responses_support__1.yml index b5a7b40f0..bd3e86cfc 100644 --- a/tests/__snapshots__/ResponseDocumentingTest__manually_annotated_responses_support__1.yml +++ b/tests/__snapshots__/ResponseDocumentingTest__manually_annotated_responses_support__1.yml @@ -5,4 +5,4 @@ info: servers: - { url: 'http://localhost/api' } paths: - /test: { get: { operationId: fooTestFour.index, tags: [Foo_TestFour], responses: { 200: { description: 'Simple comment.', content: { application/json: { schema: { type: object, properties: { foo: { type: string, enum: [bar] } }, required: [foo] } } } }, 201: { description: "Advanced comment.\n\nWith more description.", content: { application/json: { schema: { type: object, properties: { foo: { type: string } }, required: [foo] } } } } } } } + /test: { get: { operationId: fooTestFour.index, tags: [Foo_TestFour], responses: { 200: { description: 'Simple comment.', content: { application/json: { schema: { type: object, properties: { foo: { type: string, const: bar } }, required: [foo] } } } }, 201: { description: "Advanced comment.\n\nWith more description.", content: { application/json: { schema: { type: object, properties: { foo: { type: string } }, required: [foo] } } } } } } } diff --git a/tests/__snapshots__/ResponseDocumentingTest__manually_annotated_responses_support__2.yml b/tests/__snapshots__/ResponseDocumentingTest__manually_annotated_responses_support__2.yml index b5a7b40f0..bd3e86cfc 100644 --- a/tests/__snapshots__/ResponseDocumentingTest__manually_annotated_responses_support__2.yml +++ b/tests/__snapshots__/ResponseDocumentingTest__manually_annotated_responses_support__2.yml @@ -5,4 +5,4 @@ info: servers: - { url: 'http://localhost/api' } paths: - /test: { get: { operationId: fooTestFour.index, tags: [Foo_TestFour], responses: { 200: { description: 'Simple comment.', content: { application/json: { schema: { type: object, properties: { foo: { type: string, enum: [bar] } }, required: [foo] } } } }, 201: { description: "Advanced comment.\n\nWith more description.", content: { application/json: { schema: { type: object, properties: { foo: { type: string } }, required: [foo] } } } } } } } + /test: { get: { operationId: fooTestFour.index, tags: [Foo_TestFour], responses: { 200: { description: 'Simple comment.', content: { application/json: { schema: { type: object, properties: { foo: { type: string, const: bar } }, required: [foo] } } } }, 201: { description: "Advanced comment.\n\nWith more description.", content: { application/json: { schema: { type: object, properties: { foo: { type: string } }, required: [foo] } } } } } } } diff --git a/tests/__snapshots__/ResponseDocumentingTest__multiple_responses_support__1.yml b/tests/__snapshots__/ResponseDocumentingTest__multiple_responses_support__1.yml index ef9cca9c7..b964df2a4 100644 --- a/tests/__snapshots__/ResponseDocumentingTest__multiple_responses_support__1.yml +++ b/tests/__snapshots__/ResponseDocumentingTest__multiple_responses_support__1.yml @@ -5,4 +5,4 @@ info: servers: - { url: 'http://localhost/api' } paths: - /test: { get: { operationId: fooTestThree.index, tags: [Foo_TestThree], responses: { 200: { description: '', content: { application/json: { schema: { anyOf: [{ type: object, properties: { foo: { type: string, enum: [bar] } }, required: [foo] }, { type: object, properties: { foo: { type: string, enum: [one] } }, required: [foo] }] } } } }, 500: { description: '', content: { application/json: { schema: { type: object, properties: { error: { type: object, properties: { msg: { type: string }, code: { type: integer } }, required: [msg, code] } }, required: [error] } } } } } } } + /test: { get: { operationId: fooTestThree.index, tags: [Foo_TestThree], responses: { 200: { description: '', content: { application/json: { schema: { anyOf: [{ type: object, properties: { foo: { type: string, const: bar } }, required: [foo] }, { type: object, properties: { foo: { type: string, const: one } }, required: [foo] }] } } } }, 500: { description: '', content: { application/json: { schema: { type: object, properties: { error: { type: object, properties: { msg: { type: string }, code: { type: integer } }, required: [msg, code] } }, required: [error] } } } } } } } diff --git a/tests/__snapshots__/ResponseDocumentingTest__multiple_responses_support__2.yml b/tests/__snapshots__/ResponseDocumentingTest__multiple_responses_support__2.yml index ef9cca9c7..b964df2a4 100644 --- a/tests/__snapshots__/ResponseDocumentingTest__multiple_responses_support__2.yml +++ b/tests/__snapshots__/ResponseDocumentingTest__multiple_responses_support__2.yml @@ -5,4 +5,4 @@ info: servers: - { url: 'http://localhost/api' } paths: - /test: { get: { operationId: fooTestThree.index, tags: [Foo_TestThree], responses: { 200: { description: '', content: { application/json: { schema: { anyOf: [{ type: object, properties: { foo: { type: string, enum: [bar] } }, required: [foo] }, { type: object, properties: { foo: { type: string, enum: [one] } }, required: [foo] }] } } } }, 500: { description: '', content: { application/json: { schema: { type: object, properties: { error: { type: object, properties: { msg: { type: string }, code: { type: integer } }, required: [msg, code] } }, required: [error] } } } } } } } + /test: { get: { operationId: fooTestThree.index, tags: [Foo_TestThree], responses: { 200: { description: '', content: { application/json: { schema: { anyOf: [{ type: object, properties: { foo: { type: string, const: bar } }, required: [foo] }, { type: object, properties: { foo: { type: string, const: one } }, required: [foo] }] } } } }, 500: { description: '', content: { application/json: { schema: { type: object, properties: { error: { type: object, properties: { msg: { type: string }, code: { type: integer } }, required: [msg, code] } }, required: [error] } } } } } } } diff --git a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type__1.yml b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type__1.yml index 4413df89f..c73ebcb7f 100644 --- a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type__1.yml +++ b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type__1.yml @@ -1,8 +1,8 @@ type: object properties: - foo: { type: integer, enum: [1] } - hey: { type: string, enum: [ho] } - bar: { type: string, enum: [foo] } + foo: { type: integer, const: 1 } + hey: { type: string, const: ho } + bar: { type: string, const: foo } required: - foo - bar diff --git a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type__2.yml b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type__2.yml index 4413df89f..c73ebcb7f 100644 --- a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type__2.yml +++ b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type__2.yml @@ -1,8 +1,8 @@ type: object properties: - foo: { type: integer, enum: [1] } - hey: { type: string, enum: [ho] } - bar: { type: string, enum: [foo] } + foo: { type: integer, const: 1 } + hey: { type: string, const: ho } + bar: { type: string, const: foo } required: - foo - bar diff --git a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_reference__1.yml b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_reference__1.yml index 4413df89f..c73ebcb7f 100644 --- a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_reference__1.yml +++ b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_reference__1.yml @@ -1,8 +1,8 @@ type: object properties: - foo: { type: integer, enum: [1] } - hey: { type: string, enum: [ho] } - bar: { type: string, enum: [foo] } + foo: { type: integer, const: 1 } + hey: { type: string, const: ho } + bar: { type: string, const: foo } required: - foo - bar diff --git a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_reference__2.yml b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_reference__2.yml index 4413df89f..c73ebcb7f 100644 --- a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_reference__2.yml +++ b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_reference__2.yml @@ -1,8 +1,8 @@ type: object properties: - foo: { type: integer, enum: [1] } - hey: { type: string, enum: [ho] } - bar: { type: string, enum: [foo] } + foo: { type: integer, const: 1 } + hey: { type: string, const: ho } + bar: { type: string, const: foo } required: - foo - bar diff --git a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_nested_merges__1.yml b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_nested_merges__1.yml index 6ac5094cd..921de8a25 100644 --- a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_nested_merges__1.yml +++ b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_nested_merges__1.yml @@ -1,9 +1,9 @@ type: object properties: - foo: { type: integer, enum: [1] } - wait: { type: object, properties: { one: { type: integer, enum: [1] }, bar: { type: string, enum: [foo] }, kek: { type: object, properties: { bar: { type: string, enum: [foo] } }, required: [bar] } }, required: [one, bar, kek] } - hey: { type: string, enum: [ho] } - bar: { type: string, enum: [foo] } + foo: { type: integer, const: 1 } + wait: { type: object, properties: { one: { type: integer, const: 1 }, bar: { type: string, const: foo }, kek: { type: object, properties: { bar: { type: string, const: foo } }, required: [bar] } }, required: [one, bar, kek] } + hey: { type: string, const: ho } + bar: { type: string, const: foo } required: - foo - wait diff --git a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_nested_merges__2.yml b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_nested_merges__2.yml index 6ac5094cd..921de8a25 100644 --- a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_nested_merges__2.yml +++ b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_nested_merges__2.yml @@ -1,9 +1,9 @@ type: object properties: - foo: { type: integer, enum: [1] } - wait: { type: object, properties: { one: { type: integer, enum: [1] }, bar: { type: string, enum: [foo] }, kek: { type: object, properties: { bar: { type: string, enum: [foo] } }, required: [bar] } }, required: [one, bar, kek] } - hey: { type: string, enum: [ho] } - bar: { type: string, enum: [foo] } + foo: { type: integer, const: 1 } + wait: { type: object, properties: { one: { type: integer, const: 1 }, bar: { type: string, const: foo }, kek: { type: object, properties: { bar: { type: string, const: foo } }, required: [bar] } }, required: [one, bar, kek] } + hey: { type: string, const: ho } + bar: { type: string, const: foo } required: - foo - wait diff --git a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when__1.yml b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when__1.yml index 1dbe16eea..75622fc57 100644 --- a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when__1.yml +++ b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when__1.yml @@ -1,6 +1,6 @@ type: object properties: - foo: { type: integer, enum: [1] } - bar: { type: [string, 'null'], enum: [b] } + foo: { type: integer, const: 1 } + bar: { type: [string, 'null'], const: b } required: - bar diff --git a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when__2.yml b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when__2.yml index 1dbe16eea..75622fc57 100644 --- a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when__2.yml +++ b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when__2.yml @@ -1,6 +1,6 @@ type: object properties: - foo: { type: integer, enum: [1] } - bar: { type: [string, 'null'], enum: [b] } + foo: { type: integer, const: 1 } + bar: { type: [string, 'null'], const: b } required: - bar diff --git a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when_counted__1.yml b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when_counted__1.yml index 611749267..fababc544 100644 --- a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when_counted__1.yml +++ b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when_counted__1.yml @@ -1,13 +1,13 @@ type: object properties: bar_single: { type: integer } - bar_fake_count: { type: integer, enum: [1] } + bar_fake_count: { type: integer, const: 1 } bar_different_literal_types: { type: integer, enum: [1, 5] } - bar_identical_literal_types: { type: integer, enum: [1] } - bar_string: { type: string, enum: ['2'] } - bar_int: { type: integer, enum: [1] } + bar_identical_literal_types: { type: integer, const: 1 } + bar_string: { type: string, const: '2' } + bar_int: { type: integer, const: 1 } bar_useless: { type: 'null' } - bar_nullable: { type: [integer, 'null'], enum: [3] } + bar_nullable: { type: [integer, 'null'], const: 3 } required: - bar_different_literal_types - bar_identical_literal_types diff --git a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when_counted__2.yml b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when_counted__2.yml index 611749267..fababc544 100644 --- a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when_counted__2.yml +++ b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when_counted__2.yml @@ -1,13 +1,13 @@ type: object properties: bar_single: { type: integer } - bar_fake_count: { type: integer, enum: [1] } + bar_fake_count: { type: integer, const: 1 } bar_different_literal_types: { type: integer, enum: [1, 5] } - bar_identical_literal_types: { type: integer, enum: [1] } - bar_string: { type: string, enum: ['2'] } - bar_int: { type: integer, enum: [1] } + bar_identical_literal_types: { type: integer, const: 1 } + bar_string: { type: string, const: '2' } + bar_int: { type: integer, const: 1 } bar_useless: { type: 'null' } - bar_nullable: { type: [integer, 'null'], enum: [3] } + bar_nullable: { type: [integer, 'null'], const: 3 } required: - bar_different_literal_types - bar_identical_literal_types diff --git a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when_loaded__1.yml b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when_loaded__1.yml index 053dc3219..8d6d0a0d3 100644 --- a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when_loaded__1.yml +++ b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when_loaded__1.yml @@ -6,8 +6,8 @@ properties: foo_new: { $ref: '#/components/schemas/ComplexTypeHandlersWithWhen_SampleType' } foo_make: { $ref: '#/components/schemas/ComplexTypeHandlersWithWhen_SampleType' } foo_collection: { type: array, items: { $ref: '#/components/schemas/ComplexTypeHandlersWithWhen_SampleType' } } - bar: { type: integer, enum: [1] } - bar_nullable: { type: [string, 'null'], enum: [s] } + bar: { type: integer, const: 1 } + bar_nullable: { type: [string, 'null'], const: s } required: - foo_new - foo_make diff --git a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when_loaded__2.yml b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when_loaded__2.yml index 053dc3219..8d6d0a0d3 100644 --- a/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when_loaded__2.yml +++ b/tests/__snapshots__/TypeToSchemaTransformerTest__it_gets_json_resource_type_with_when_loaded__2.yml @@ -6,8 +6,8 @@ properties: foo_new: { $ref: '#/components/schemas/ComplexTypeHandlersWithWhen_SampleType' } foo_make: { $ref: '#/components/schemas/ComplexTypeHandlersWithWhen_SampleType' } foo_collection: { type: array, items: { $ref: '#/components/schemas/ComplexTypeHandlersWithWhen_SampleType' } } - bar: { type: integer, enum: [1] } - bar_nullable: { type: [string, 'null'], enum: [s] } + bar: { type: integer, const: 1 } + bar_nullable: { type: [string, 'null'], const: s } required: - foo_new - foo_make diff --git a/tests/__snapshots__/ValidationRulesDocumentingTest__it_extracts_rules_from_request__validate_call__1.yml b/tests/__snapshots__/ValidationRulesDocumentingTest__it_extracts_rules_from_request__validate_call__1.yml index 51cc4aa6d..05a43aa3c 100644 --- a/tests/__snapshots__/ValidationRulesDocumentingTest__it_extracts_rules_from_request__validate_call__1.yml +++ b/tests/__snapshots__/ValidationRulesDocumentingTest__it_extracts_rules_from_request__validate_call__1.yml @@ -7,5 +7,5 @@ servers: paths: /test: { get: { operationId: validationRulesDocumentingTest.index, tags: [ValidationRulesDocumenting_Test], parameters: [{ name: content, in: query, required: true, schema: { type: string, enum: [wow] } }], responses: { 200: { description: '`ValidationRulesDocumenting_TestResource`', content: { application/json: { schema: { type: object, properties: { data: { $ref: '#/components/schemas/ValidationRulesDocumenting_TestResource' } }, required: [data] } } } }, 422: { $ref: '#/components/responses/ValidationException' } } } } components: - schemas: { ValidationRulesDocumenting_TestResource: { type: object, properties: { id: { type: integer, enum: [1] } }, required: [id], title: ValidationRulesDocumenting_TestResource } } + schemas: { ValidationRulesDocumenting_TestResource: { type: object, properties: { id: { type: integer, const: 1 } }, required: [id], title: ValidationRulesDocumenting_TestResource } } responses: { ValidationException: { description: 'Validation error', content: { application/json: { schema: { type: object, properties: { message: { type: string, description: 'Errors overview.' }, errors: { type: object, description: 'A detailed description of each field that failed validation.', additionalProperties: { type: array, items: { type: string } } } }, required: [message, errors] } } } } } diff --git a/tests/__snapshots__/ValidationRulesDocumentingTest__it_extracts_rules_from_request__validate_call__2.yml b/tests/__snapshots__/ValidationRulesDocumentingTest__it_extracts_rules_from_request__validate_call__2.yml index 51cc4aa6d..05a43aa3c 100644 --- a/tests/__snapshots__/ValidationRulesDocumentingTest__it_extracts_rules_from_request__validate_call__2.yml +++ b/tests/__snapshots__/ValidationRulesDocumentingTest__it_extracts_rules_from_request__validate_call__2.yml @@ -7,5 +7,5 @@ servers: paths: /test: { get: { operationId: validationRulesDocumentingTest.index, tags: [ValidationRulesDocumenting_Test], parameters: [{ name: content, in: query, required: true, schema: { type: string, enum: [wow] } }], responses: { 200: { description: '`ValidationRulesDocumenting_TestResource`', content: { application/json: { schema: { type: object, properties: { data: { $ref: '#/components/schemas/ValidationRulesDocumenting_TestResource' } }, required: [data] } } } }, 422: { $ref: '#/components/responses/ValidationException' } } } } components: - schemas: { ValidationRulesDocumenting_TestResource: { type: object, properties: { id: { type: integer, enum: [1] } }, required: [id], title: ValidationRulesDocumenting_TestResource } } + schemas: { ValidationRulesDocumenting_TestResource: { type: object, properties: { id: { type: integer, const: 1 } }, required: [id], title: ValidationRulesDocumenting_TestResource } } responses: { ValidationException: { description: 'Validation error', content: { application/json: { schema: { type: object, properties: { message: { type: string, description: 'Errors overview.' }, errors: { type: object, description: 'A detailed description of each field that failed validation.', additionalProperties: { type: array, items: { type: string } } } }, required: [message, errors] } } } } }