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

Callback pathItems are missing in OpenAPI Instance due to decoding issue #196

Closed
abdelfetah18 opened this issue Dec 15, 2024 · 0 comments · Fixed by #199
Closed

Callback pathItems are missing in OpenAPI Instance due to decoding issue #196

abdelfetah18 opened this issue Dec 15, 2024 · 0 comments · Fixed by #199

Comments

@abdelfetah18
Copy link
Contributor

I’ve declared some callbacks in the OpenAPI definition, but when I try to print them, the callback path items are missing. It seems like this might be an encoding issue, causing the paths not to be properly parsed or included when the file is read.

Here’s my test file for reference:

{
  "openapi": "3.0.3",
  "info": {
    "title": "Simple Pet Store API",
    "version": "1.0.0"
  },
  "paths": {
    "/pets": {
      "post": {
        "summary": "Add a new pet",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "integer"
                  },
                  "name": {
                    "type": "string"
                  },
                  "tag": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Pet created successfully."
          }
        },
        "callbacks": {
          "onPetStatusChange": {
            "{$request.body#/callbackUrl}": {
              "post": {
                "summary": "Notify about pet status change",
                "description": "This callback is triggered whenever the status of a pet changes.",
                "requestBody": {
                  "required": true,
                  "content": {
                    "application/json": {
                      "schema": {
                        "type": "object",
                        "properties": {
                          "status": {
                            "type": "string",
                            "description": "The new status of the pet.",
                            "enum": [
                              "available",
                              "pending",
                              "sold"
                            ]
                          },
                          "timestamp": {
                            "type": "string",
                            "format": "date-time",
                            "description": "The time when the status change occurred."
                          },
                          "petId": {
                            "type": "integer",
                            "description": "The unique ID of the pet whose status changed."
                          }
                        },
                        "required": [
                          "status",
                          "timestamp",
                          "petId"
                        ]
                      }
                    }
                  }
                },
                "responses": {
                  "200": {
                    "description": "Callback successfully processed."
                  },
                  "400": {
                    "description": "Invalid payload provided.",
                    "content": {
                      "application/json": {
                        "schema": {
                          "type": "object",
                          "properties": {
                            "error": {
                              "type": "string",
                              "description": "Details about the error."
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
@abdelfetah18 abdelfetah18 changed the title Callbacks Missing in OpenAPI Instance Due to Encoding Issue Callback pathItems are missing in OpenAPI Instance due to decoding issue Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant