MarketSquare / roboswag

Apache License 2.0
26 stars 2 forks source link

Compare schema #10

Closed bhirsz closed 2 years ago

bhirsz commented 2 years ago

Generate endpoint classes with the option of veryfing response schema. For example given this swagger:

  "200": {
    "description": "a pet to be returned",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Pet"
        }
      }
    }
  },
  "default": {
    "description": "Unexpected error",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorModel"
        }
      }
    }
  }
}

we could generate following mapping:


responses = {
    "200": Pet
    "default": "ErrorModel"
}
And if "verify_schema" is set to True (default True) it would verify the received response schema.
mnojek commented 2 years ago

Implemented.