Created
January 21, 2022 10:42
-
-
Save muller/bb54738c14211450de56ba1a3fd89ca9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: 3.0.3 | |
info: | |
title: PAPI - Filtering | |
version: 0.1.0 | |
paths: | |
/users_deep_object: | |
get: | |
parameters: | |
- in: query | |
name: age | |
schema: | |
$ref: '#/components/schemas/UserFilter' | |
responses: | |
200: | |
description: a user | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/User' | |
/users_name_prefix: | |
get: | |
parameters: | |
- in: query | |
name: age | |
schema: | |
type: integer | |
- in: query | |
name: min:age | |
schema: | |
type: integer | |
- in: query | |
name: max:age | |
schema: | |
type: integer | |
responses: | |
200: | |
description: a user | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/User' | |
/users_complex_values: | |
get: | |
parameters: | |
- in: query | |
name: age | |
schema: | |
type: string | |
pattern: 'min:\d+' | |
- in: query | |
name: name | |
schema: | |
type: string | |
pattern: 'like:.+' | |
responses: | |
200: | |
description: a user | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/User' | |
components: | |
schemas: | |
User: | |
type: object | |
properties: | |
age: | |
type: integer | |
name: | |
type: string | |
EqualsStringFilter: | |
type: object | |
properties: | |
eq: | |
type: string | |
LikeStringFilter: | |
type: object | |
properties: | |
like: | |
type: string | |
EqualsIntegerFilter: | |
type: object | |
properties: | |
eq: | |
type: integer | |
GreaterThanIntegerFilter: | |
type: object | |
properties: | |
gt: | |
type: integer | |
LessThanIntegerFilter: | |
type: object | |
properties: | |
lt: | |
type: integer | |
DefaultIntgerFilters: | |
oneOf: | |
- $ref: '#/components/schemas/EqualsIntegerFilter' | |
- $ref: '#/components/schemas/GreaterThanIntegerFilter' | |
- $ref: '#/components/schemas/LessThanIntegerFilter' | |
DefaultStringFilters: | |
oneOf: | |
- $ref: '#/components/schemas/EqualsStringFilter' | |
- $ref: '#/components/schemas/LikeStringFilter' | |
UserFilter: | |
type: object | |
properties: | |
age: | |
$ref: '#/components/schemas/DefaultIntgerFilters' | |
name: | |
$ref: '#/components/schemas/DefaultStringFilters' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment