For the Client this one is inside of client.yaml
/clients:
get:
tags:
- "Clients"
description: "List Clients The list capability"
produces:
- "application/json"
parameters:
- name: "tenantIdentifier"
in: "query"
required: true
type: "array"
items:
type: "string"
enum:
- "default"
responses:
200:
description: "successful operation"
400:
description: "Invalid status value"
security:
- basicAuth: []
post:
tags:
- "Clients"
summary: "Create client if address is enabled"
description: ""
operationId: "addClient"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- name: "tenantIdentifier"
in: "query"
description: ""
required: true
type: "array"
items:
type: "string"
enum:
- "default"
- in: "body"
name: "body"
description: "Add what do you wnat to add "
required: true
schema:
allOf:
- $ref: '#/definitions/ClientStructure1'
- $ref: '#/definitions/ClientStructure2'
- $ref: '#/definitions/ClientStructure3'
responses:
405:
description: "Invalid input"
security:
- basicAuth: []
For the USER this is inside of user.yaml
/users:
get:
tags:
- "Users"
summary: "Retrieve list of users"
produces:
- "application/json"
parameters:
- name: "tenantIdentifier"
in: "query"
required: true
type: "array"
items:
type: "string"
enum:
- "default"
responses:
200:
description: "successful operation"
400:
description: "Invalid status value"
security:
- basicAuth: []
post:
tags:
- "Users"
summary: "Adds new application user."
description: "Note: Password information is not required (or processed). Password details at present are auto-generated and then sent to the email account given (which is why it can take a few seconds to complete)."
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- name: "tenantIdentifier"
in: "query"
description: ""
required: true
type: "array"
items:
type: "string"
enum:
- "default"
- in: "body"
name: "body"
description: "Mandatory Fields: username, firstname, lastname, email, officeId, roles, sendPasswordToEmail"
required: true
schema:
$ref: "#/definitions/StructureForCreateUSer"
responses:
400:
description: ""
404:
description: ""
security:
- basicAuth: []
The static yaml file is fetched from Swagger Editor, put it under the resources directory. info: description: "This is a sample server Petstore server.
YAML is a superset of JSON For example, the Swagger UI can read the openapi. json or openapi. yaml files equivalently. Pretty much any parser that reads JSON will also read YAML. However, some JSON parsers might not read YAML because there are a few features YAML has that JSON lacks (more on that below).
Swagger definitions can be written in JSON or YAML.
You can't $ref
whole paths, but you can $ref
the contents of individual paths. In your example, you can use:
paths:
/clients:
$ref: clients.yaml#/~1clients
/users:
$ref: users.yaml#/~1users
clients.yaml#/~1clients
means we take the clients.yaml
file, then read the contents of the /clients
node in that file and substitute the $ref
with that contents. ~1clients
is /clients
with /
escaped as ~1
according to JSON Pointer rules.
To simplify the references, you can remove the /clients:
and /users:
nodes from your clients.yaml
and users.yaml
files
# clients.yaml
get:
description: "List Clients The list capability"
...
post:
summary: "Create client if address is enabled"
...
and then use
paths:
/clients:
$ref: clients.yaml
/users:
$ref: users.yaml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With