mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-06-18 18:16:26 +00:00
Refactor API Schema and validation
- /schema now returns full openapi/swagger schema - That schema is used to validate incoming requests - And used as a contract in future integration tests - Moved route files up one level - Fixed incorrect 404 reponses when getting objects - Fixed saving new objects and passing jsonschemavalidation
This commit is contained in:
88
backend/schema/paths/users/post.json
Normal file
88
backend/schema/paths/users/post.json
Normal file
@ -0,0 +1,88 @@
|
||||
{
|
||||
"operationId": "createUser",
|
||||
"summary": "Create a User",
|
||||
"tags": ["Users"],
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": ["users"]
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"description": "User Payload",
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["name", "nickname", "email"],
|
||||
"properties": {
|
||||
"name": {
|
||||
"$ref": "../../components/user-object.json#/properties/name"
|
||||
},
|
||||
"nickname": {
|
||||
"$ref": "../../components/user-object.json#/properties/nickname"
|
||||
},
|
||||
"email": {
|
||||
"$ref": "../../components/user-object.json#/properties/email"
|
||||
},
|
||||
"roles": {
|
||||
"$ref": "../../components/user-object.json#/properties/roles"
|
||||
},
|
||||
"is_disabled": {
|
||||
"$ref": "../../components/user-object.json#/properties/is_disabled"
|
||||
},
|
||||
"auth": {
|
||||
"type": "object",
|
||||
"description": "Auth Credentials",
|
||||
"example": {
|
||||
"type": "password",
|
||||
"secret": "bigredhorsebanana"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "201 response",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"examples": {
|
||||
"default": {
|
||||
"value": {
|
||||
"id": 2,
|
||||
"created_on": "2020-01-30T09:41:04.000Z",
|
||||
"modified_on": "2020-01-30T09:41:04.000Z",
|
||||
"is_disabled": 0,
|
||||
"email": "jc@jc21.com",
|
||||
"name": "Jamie Curnow",
|
||||
"nickname": "James",
|
||||
"avatar": "//www.gravatar.com/avatar/6193176330f8d38747f038c170ddb193?default=mm",
|
||||
"roles": ["admin"],
|
||||
"permissions": {
|
||||
"id": 3,
|
||||
"created_on": "2020-01-30T09:41:04.000Z",
|
||||
"modified_on": "2020-01-30T09:41:04.000Z",
|
||||
"user_id": 2,
|
||||
"visibility": "user",
|
||||
"proxy_hosts": "manage",
|
||||
"redirection_hosts": "manage",
|
||||
"dead_hosts": "manage",
|
||||
"streams": "manage",
|
||||
"access_lists": "manage",
|
||||
"certificates": "manage"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"schema": {
|
||||
"$ref": "../../components/user-object.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user