Skip to content

Commit

Permalink
feat: introduce 409 conflict error code
Browse files Browse the repository at this point in the history
Close #107
  • Loading branch information
adriantam committed Nov 27, 2023
1 parent 0f1d73e commit 871b2d5
Show file tree
Hide file tree
Showing 6 changed files with 472 additions and 160 deletions.
111 changes: 111 additions & 0 deletions docs/openapiv2/apidocs.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
"$ref": "#/definitions/PathUnknownErrorMessageResponse"
}
},
"409": {
"description": "Request failed due to aborted.",
"schema": {
"$ref": "#/definitions/AbortedMessageResponse"
}
},
"500": {
"description": "Request failed due to internal server error.",
"schema": {
Expand Down Expand Up @@ -102,6 +108,12 @@
"$ref": "#/definitions/PathUnknownErrorMessageResponse"
}
},
"409": {
"description": "Request failed due to aborted.",
"schema": {
"$ref": "#/definitions/AbortedMessageResponse"
}
},
"500": {
"description": "Request failed due to internal server error.",
"schema": {
Expand Down Expand Up @@ -148,6 +160,12 @@
"$ref": "#/definitions/PathUnknownErrorMessageResponse"
}
},
"409": {
"description": "Request failed due to aborted.",
"schema": {
"$ref": "#/definitions/AbortedMessageResponse"
}
},
"500": {
"description": "Request failed due to internal server error.",
"schema": {
Expand Down Expand Up @@ -187,6 +205,12 @@
"$ref": "#/definitions/PathUnknownErrorMessageResponse"
}
},
"409": {
"description": "Request failed due to aborted.",
"schema": {
"$ref": "#/definitions/AbortedMessageResponse"
}
},
"500": {
"description": "Request failed due to internal server error.",
"schema": {
Expand Down Expand Up @@ -231,6 +255,12 @@
"$ref": "#/definitions/PathUnknownErrorMessageResponse"
}
},
"409": {
"description": "Request failed due to aborted.",
"schema": {
"$ref": "#/definitions/AbortedMessageResponse"
}
},
"500": {
"description": "Request failed due to internal server error.",
"schema": {
Expand Down Expand Up @@ -276,6 +306,12 @@
"$ref": "#/definitions/PathUnknownErrorMessageResponse"
}
},
"409": {
"description": "Request failed due to aborted.",
"schema": {
"$ref": "#/definitions/AbortedMessageResponse"
}
},
"500": {
"description": "Request failed due to internal server error.",
"schema": {
Expand Down Expand Up @@ -346,6 +382,12 @@
"$ref": "#/definitions/PathUnknownErrorMessageResponse"
}
},
"409": {
"description": "Request failed due to aborted.",
"schema": {
"$ref": "#/definitions/AbortedMessageResponse"
}
},
"500": {
"description": "Request failed due to internal server error.",
"schema": {
Expand Down Expand Up @@ -401,6 +443,12 @@
"$ref": "#/definitions/PathUnknownErrorMessageResponse"
}
},
"409": {
"description": "Request failed due to aborted.",
"schema": {
"$ref": "#/definitions/AbortedMessageResponse"
}
},
"500": {
"description": "Request failed due to internal server error.",
"schema": {
Expand Down Expand Up @@ -468,6 +516,12 @@
"$ref": "#/definitions/PathUnknownErrorMessageResponse"
}
},
"409": {
"description": "Request failed due to aborted.",
"schema": {
"$ref": "#/definitions/AbortedMessageResponse"
}
},
"500": {
"description": "Request failed due to internal server error.",
"schema": {
Expand Down Expand Up @@ -518,6 +572,12 @@
"$ref": "#/definitions/PathUnknownErrorMessageResponse"
}
},
"409": {
"description": "Request failed due to aborted.",
"schema": {
"$ref": "#/definitions/AbortedMessageResponse"
}
},
"500": {
"description": "Request failed due to internal server error.",
"schema": {
Expand Down Expand Up @@ -581,6 +641,12 @@
"$ref": "#/definitions/PathUnknownErrorMessageResponse"
}
},
"409": {
"description": "Request failed due to aborted.",
"schema": {
"$ref": "#/definitions/AbortedMessageResponse"
}
},
"500": {
"description": "Request failed due to internal server error.",
"schema": {
Expand Down Expand Up @@ -654,6 +720,12 @@
"$ref": "#/definitions/PathUnknownErrorMessageResponse"
}
},
"409": {
"description": "Request failed due to aborted.",
"schema": {
"$ref": "#/definitions/AbortedMessageResponse"
}
},
"500": {
"description": "Request failed due to internal server error.",
"schema": {
Expand Down Expand Up @@ -718,6 +790,12 @@
"$ref": "#/definitions/PathUnknownErrorMessageResponse"
}
},
"409": {
"description": "Request failed due to aborted.",
"schema": {
"$ref": "#/definitions/AbortedMessageResponse"
}
},
"500": {
"description": "Request failed due to internal server error.",
"schema": {
Expand Down Expand Up @@ -798,6 +876,12 @@
"$ref": "#/definitions/PathUnknownErrorMessageResponse"
}
},
"409": {
"description": "Request failed due to aborted.",
"schema": {
"$ref": "#/definitions/AbortedMessageResponse"
}
},
"500": {
"description": "Request failed due to internal server error.",
"schema": {
Expand Down Expand Up @@ -873,6 +957,12 @@
"$ref": "#/definitions/PathUnknownErrorMessageResponse"
}
},
"409": {
"description": "Request failed due to aborted.",
"schema": {
"$ref": "#/definitions/AbortedMessageResponse"
}
},
"500": {
"description": "Request failed due to internal server error.",
"schema": {
Expand Down Expand Up @@ -953,6 +1043,12 @@
"$ref": "#/definitions/PathUnknownErrorMessageResponse"
}
},
"409": {
"description": "Request failed due to aborted.",
"schema": {
"$ref": "#/definitions/AbortedMessageResponse"
}
},
"500": {
"description": "Request failed due to internal server error.",
"schema": {
Expand Down Expand Up @@ -995,6 +1091,21 @@
}
},
"definitions": {
"AbortedMessageResponse": {
"type": "object",
"example": {
"code": "10",
"message": "transaction conflict"
},
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
}
},
"Any": {
"type": "object",
"properties": {
Expand Down
6 changes: 6 additions & 0 deletions openfga/v1/errors_ignore.proto
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,10 @@ message PathUnknownErrorMessageResponse {
string message = 2;
}

message AbortedMessageResponse {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = {example: "{\"code\":\"10\", \"message\":\"transaction conflict\"}"};
string code = 1;
string message = 2;
}

message ErrorMessageRequest {}
9 changes: 9 additions & 0 deletions openfga/v1/openapi.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
json_schema: {ref: ".openfga.v1.PathUnknownErrorMessageResponse"}
}
}
}
responses: {
key: "409"
value: {
description: "Request failed due to aborted."
schema: {
json_schema: {ref: ".openfga.v1.AbortedMessageResponse"}
}
}
}
responses: {
key: "500"
Expand Down
Loading

0 comments on commit 871b2d5

Please sign in to comment.