Skip to content

Commit 47828e9

Browse files
committed
feat: reference formats
1 parent ad54075 commit 47828e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+572
-383
lines changed

.github/workflows/ci.yml

+4-6
Original file line numberDiff line numberDiff line change
@@ -425,16 +425,15 @@ jobs:
425425
- name: Export OpenAPI documents
426426
run: |
427427
mkdir -p build/out/openapi
428-
tests/Fixtures/app/console api:openapi:export -o build/out/openapi/openapi_v3.json
428+
# tests/Fixtures/app/console api:openapi:export -o build/out/openapi/openapi_v3.json
429429
tests/Fixtures/app/console api:openapi:export --yaml -o build/out/openapi/openapi_v3.yaml
430430
- name: Setup node
431431
uses: actions/setup-node@v4
432432
with:
433433
node-version: '14'
434434
- name: Validate OpenAPI documents
435435
run: |
436-
npx swagger-cli validate build/out/openapi/openapi_v3.json
437-
npx swagger-cli validate build/out/openapi/openapi_v3.yaml
436+
npx @quobix/vacuum lint validate build/out/openapi/openapi_v3.yaml
438437
- name: Upload OpenAPI artifacts
439438
if: always()
440439
uses: actions/upload-artifact@v4
@@ -1227,16 +1226,15 @@ jobs:
12271226
- name: Export OpenAPI documents
12281227
run: |
12291228
mkdir -p build/out/openapi
1230-
tests/Fixtures/app/console api:openapi:export -o build/out/openapi/openapi_v3.json
1229+
# tests/Fixtures/app/console api:openapi:export -o build/out/openapi/openapi_v3.json
12311230
tests/Fixtures/app/console api:openapi:export --yaml -o build/out/openapi/openapi_v3.yaml
12321231
- name: Setup node
12331232
uses: actions/setup-node@v4
12341233
with:
12351234
node-version: '14'
12361235
- name: Validate OpenAPI documents
12371236
run: |
1238-
npx swagger-cli validate build/out/openapi/openapi_v3.json
1239-
npx swagger-cli validate build/out/openapi/openapi_v3.yaml
1237+
npx @quobix/vacuum lint validate build/out/openapi/openapi_v3.yaml
12401238
- name: Upload OpenAPI artifacts
12411239
if: always()
12421240
uses: actions/upload-artifact@v4

features/openapi/docs.feature

+1-108
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,9 @@ Feature: Documentation support
153153
And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters" should have 6 elements
154154

155155
# Subcollection - check schema
156-
And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.responses.200.content.application/ld+json.schema.properties.hydra:member.items.$ref" should be equal to "#/components/schemas/RelatedToDummyFriend.jsonld-fakemanytomany"
156+
And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.responses.200.content.application/ld+json.schema.allOf[1].properties.hydra:member.items.$ref" should be equal to "#/components/schemas/RelatedToDummyFriend.jsonld-fakemanytomany"
157157

158158
# Deprecations
159-
And the JSON node "paths./dummies.get.deprecated" should be false
160159
And the JSON node "paths./deprecated_resources.get.deprecated" should be true
161160
And the JSON node "paths./deprecated_resources.post.deprecated" should be true
162161
And the JSON node "paths./deprecated_resources/{id}.get.deprecated" should be true
@@ -166,111 +165,6 @@ Feature: Documentation support
166165

167166
# Formats
168167
And the OpenAPI class "Dummy.jsonld" exists
169-
And the "@id" property exists for the OpenAPI class "Dummy.jsonld"
170-
And the JSON node "paths./dummies.get.responses.200.content.application/ld+json" should be equal to:
171-
"""
172-
{
173-
"schema": {
174-
"type": "object",
175-
"properties": {
176-
"hydra:member": {
177-
"type": "array",
178-
"items": {
179-
"$ref": "#/components/schemas/Dummy.jsonld"
180-
}
181-
},
182-
"hydra:totalItems": {
183-
"type": "integer",
184-
"minimum": 0
185-
},
186-
"hydra:view": {
187-
"type": "object",
188-
"properties": {
189-
"@id": {
190-
"type": "string",
191-
"format": "iri-reference"
192-
},
193-
"@type": {
194-
"type": "string"
195-
},
196-
"hydra:first": {
197-
"type": "string",
198-
"format": "iri-reference"
199-
},
200-
"hydra:last": {
201-
"type": "string",
202-
"format": "iri-reference"
203-
},
204-
"hydra:previous": {
205-
"type": "string",
206-
"format": "iri-reference"
207-
},
208-
"hydra:next": {
209-
"type": "string",
210-
"format": "iri-reference"
211-
}
212-
},
213-
"example": {
214-
"@id": "string",
215-
"type": "string",
216-
"hydra:first": "string",
217-
"hydra:last": "string",
218-
"hydra:previous": "string",
219-
"hydra:next": "string"
220-
}
221-
},
222-
"hydra:search": {
223-
"type": "object",
224-
"properties": {
225-
"@type": {
226-
"type": "string"
227-
},
228-
"hydra:template": {
229-
"type": "string"
230-
},
231-
"hydra:variableRepresentation": {
232-
"type": "string"
233-
},
234-
"hydra:mapping": {
235-
"type": "array",
236-
"items": {
237-
"type": "object",
238-
"properties": {
239-
"@type": {
240-
"type": "string"
241-
},
242-
"variable": {
243-
"type": "string"
244-
},
245-
"property": {
246-
"type": ["string", "null"]
247-
},
248-
"required": {
249-
"type": "boolean"
250-
}
251-
}
252-
}
253-
}
254-
}
255-
}
256-
},
257-
"required": [
258-
"hydra:member"
259-
]
260-
}
261-
}
262-
"""
263-
And the JSON node "paths./dummies.get.responses.200.content.application/json" should be equal to:
264-
"""
265-
{
266-
"schema": {
267-
"type": "array",
268-
"items": {
269-
"$ref": "#/components/schemas/Dummy"
270-
}
271-
}
272-
}
273-
"""
274168
And the JSON node "paths./override_open_api_responses.post.responses" should be equal to:
275169
"""
276170
{
@@ -322,7 +216,6 @@ Feature: Documentation support
322216
And the "resourceRelated" property for the OpenAPI class "Resource" should be equal to:
323217
"""
324218
{
325-
"readOnly": true,
326219
"anyOf": [
327220
{
328221
"$ref": "#/components/schemas/ResourceRelated"

src/Doctrine/Odm/Filter/DateFilter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ private function addMatch(Builder $aggregationBuilder, string $field, string $op
248248
*/
249249
public function getSchema(Parameter $parameter): array
250250
{
251-
return ['type' => 'date'];
251+
return ['type' => 'string', 'format' => 'date'];
252252
}
253253

254254
public function getOpenApiParameters(Parameter $parameter): OpenApiParameter|array|null

src/Doctrine/Odm/Filter/NumericFilter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,6 @@ protected function getType(?string $doctrineType = null): string
168168

169169
public function getSchema(Parameter $parameter): array
170170
{
171-
return ['type' => 'numeric'];
171+
return ['type' => 'number'];
172172
}
173173
}

src/Doctrine/Orm/Filter/DateFilter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ protected function addWhere(QueryBuilder $queryBuilder, QueryNameGeneratorInterf
280280
*/
281281
public function getSchema(Parameter $parameter): array
282282
{
283-
return ['type' => 'date'];
283+
return ['type' => 'string', 'format' => 'date'];
284284
}
285285

286286
public function getOpenApiParameters(Parameter $parameter): OpenApiParameter|array|null

src/Doctrine/Orm/Filter/NumericFilter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,6 @@ protected function getType(?string $doctrineType = null): string
181181

182182
public function getSchema(Parameter $parameter): array
183183
{
184-
return ['type' => 'numeric'];
184+
return ['type' => 'number'];
185185
}
186186
}

0 commit comments

Comments
 (0)