Skip to content

Commit 6607f93

Browse files
committed
feat: find products by identifier
This change replaces the `tei_urn` query parameter with a pair of `idType/idValue` parameters to filter products using all the available identifiers. The ideal solution in this case would be to use a single parameter with schema `#/components/schemas/identifier` together with [RFC 6570-style serialization](https://swagger.io/specification/#style-examples): ```yaml identifier-param: name: identifierParam description: If present, only the objects with the given identifier will be returned. in: query schema: $ref: "#/components/schemas/identifier" style: form explode: true ``` This is currently not a viable option, since limitations of the `openapi-generator` like OpenAPITools/openapi-generator#4808 would cause bugs in the generated clients. Signed-off-by: Piotr P. Karwasz <[email protected]>
1 parent d36672d commit 6607f93

File tree

1 file changed

+39
-7
lines changed

1 file changed

+39
-7
lines changed

spec/openapi.yaml

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# $schema: https://spec.openapis.org/oas/3.1/schema-base/2025-02-13
12
openapi: 3.1.1
23
jsonSchemaDialect: https://spec.openapis.org/oas/3.1/dialect/base
34
info:
@@ -49,7 +50,8 @@ paths:
4950
parameters:
5051
- $ref: "#/components/parameters/page-offset"
5152
- $ref: "#/components/parameters/page-size"
52-
- $ref: "#/components/parameters/tei_urn"
53+
- $ref: "#/components/parameters/id-type"
54+
- $ref: "#/components/parameters/id-value"
5355
responses:
5456
'200':
5557
$ref: "#/components/responses/paginated-product"
@@ -680,15 +682,45 @@ components:
680682
type: number
681683
format: int64
682684
default: 100
683-
# Identifiers
684-
tei_urn:
685-
name: tei_urn
686-
description: Transparency Exchange Identifier (URN)
685+
#
686+
# Query by identifier
687+
#
688+
# Since OpenAPI 3.0 it is possible to use RFC 6570-based serialization for JSON parameters of type array or object:
689+
# https://swagger.io/docs/specification/v3_0/serialization/
690+
#
691+
# Unfortunately many tools don't support it, for example,
692+
# the `openapi-generator` for Java does not handle this correctly.
693+
# https://github.com/OpenAPITools/openapi-generator/issues/4808
694+
#
695+
# This can be uncommented, when RFC 6570-base serialization reaches a wider adoption:
696+
#
697+
# identifier-param:
698+
# name: identifierParam
699+
# description: If present, only the objects with the given identifier will be returned.
700+
# in: query
701+
# schema:
702+
# $ref: "#/components/schemas/identifier"
703+
# style: form
704+
# explode: true
705+
#
706+
# In the meantime we explode the object manually:
707+
id-type:
708+
# To allow RFC 6570 in the future without breaking changes to the HTTP API,
709+
# the name of this parameter should be identical to the equivalent property in /components/schemas/identifier
710+
name: idType
711+
description: Type of identifier specified in the `idValue` parameter
712+
in: query
713+
schema:
714+
$ref: "#/components/schemas/identifier-type"
715+
id-value:
716+
# To allow RFC 6570 in the future without breaking changes to the HTTP API,
717+
# the name of this parameter should be identical to the equivalent property in /components/schemas/identifier
718+
name: idValue
719+
description: If present, only the objects with the given identifier value will be returned.
687720
in: query
688-
required: true
689721
schema:
690722
type: string
691-
pattern: '^urn:tei:[a-z]+:[a-zA-Z0-9.-]+:[a-zA-Z0-9-]+$'
723+
692724
securitySchemes:
693725
bearerAuth:
694726
type: http

0 commit comments

Comments
 (0)