Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cat-gateway): Fix health endpoints response schema and status code #1538

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

bkioshn
Copy link
Contributor

@bkioshn bkioshn commented Jan 17, 2025

Description

DO NOT MERGE THIS PR, SINCE STATUS CODE ISSUE IS NOT RESOLVED

  • Fix response violates schema error happen in schemathesis

Related Issue(s)

Closes #1501

Description of Changes

Since the fields in ContentErrorDetail can be None, add nullable

Schema

Schema before

"ContentErrorDetail": {
        "type": "object",
        "description": "Individual details of a single error that was detected with the content of the\nrequest.",
        "properties": {
          "loc": {
            "type": "array",
            "description": "The location of the error",
            "items": {
              "type": "string",
              "format": "error",
              "title": "Error Message",
              "description": "This is an error message.",
              "example": "An error has occurred, the details of the error are ...",
              "maxLength": 256,
              "minLength": 1,
              "pattern": "^(.){1,256}$"
            },
            "maxItems": 100
          },
          "msg": {
            "type": "string",
            "format": "error",
            "title": "Error Message",
            "description": "The error message.",
            "example": "An error has occurred, the details of the error are ...",
            "maxLength": 1000,
            "minLength": 1,
            "pattern": "^[0-9a-zA-Z].*$"
          },
          "type": {
            "type": "string",
            "format": "error",
            "title": "Error Message",
            "description": "The type of error",
            "example": "An error has occurred, the details of the error are ...",
            "maxLength": 1000,
            "minLength": 1,
            "pattern": "^[0-9a-zA-Z].*$"
          }
        },
        "example": {
          "loc": [
            "body"
          ],
          "msg": "Value is not a valid dict.",
          "type": "type_error.dict"
        }
      },

After

 "ContentErrorDetail": {
        "type": "object",
        "description": "Individual details of a single error that was detected with the content of the\nrequest.",
        "properties": {
          "loc": {
            "type": "array",
            "description": "The location of the error",
            "items": {
              "type": "string",
              "format": "error",
              "title": "Error Message",
              "description": "This is an error message.",
              "example": "An error has occurred, the details of the error are ...",
              "maxLength": 256,
              "minLength": 1,
              "pattern": "^(.){1,256}$"
            },
            "nullable": true,
            "maxItems": 100
          },
          "msg": {
            "type": "string",
            "format": "error",
            "title": "Error Message",
            "description": "The error message.",
            "nullable": true,
            "example": "An error has occurred, the details of the error are ...",
            "maxLength": 1000,
            "minLength": 1,
            "pattern": "^[0-9a-zA-Z].*$"
          },
          "type": {
            "type": "string",
            "format": "error",
            "title": "Error Message",
            "description": "The type of error",
            "nullable": true,
            "example": "An error has occurred, the details of the error are ...",
            "maxLength": 1000,
            "minLength": 1,
            "pattern": "^[0-9a-zA-Z].*$"
          }
        },
        "example": {
          "loc": [
            "body"
          ],
          "msg": "Value is not a valid dict.",
          "type": "type_error.dict"
        }
      },

Please confirm the following checks

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream module

@bkioshn bkioshn marked this pull request as draft January 17, 2025 09:16
@bkioshn bkioshn added the do not merge yet PR is not ready to be merged yet label Jan 17, 2025
Copy link
Contributor

Test Report | ${\color{lightgreen}Pass: 392/392}$ | ${\color{red}Fail: 0/392}$ |

Copy link
Contributor

Test Report | ${\color{lightgreen}Pass: 389/392}$ | ${\color{red}Fail: 3/392}$ |

Copy link
Contributor

Test Report | ${\color{lightgreen}Pass: 389/392}$ | ${\color{red}Fail: 3/392}$ |

Copy link
Contributor

Test Report | ${\color{lightgreen}Pass: 409/412}$ | ${\color{red}Fail: 3/412}$ |

Copy link
Contributor

Test Report | ${\color{lightgreen}Pass: 442/445}$ | ${\color{red}Fail: 3/445}$ |

Copy link
Contributor

Test Report | ${\color{lightgreen}Pass: 442/445}$ | ${\color{red}Fail: 3/445}$ |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do not merge yet PR is not ready to be merged yet
Projects
Status: New
Development

Successfully merging this pull request may close these issues.

Health endpoints response schema and status code conformance
4 participants