Dorthu / openapi3

A Python3 OpenAPI 3 Spec Parser
BSD 3-Clause "New" or "Revised" License
118 stars 47 forks source link

"required" parameter to be list #111

Open nandishaivalli opened 1 year ago

nandishaivalli commented 1 year ago

From openAPI-3 spec of spotify. The paths./playlists/{playlist_id}/images.put.requestBody.content.image/jpeg.schema.required path is True. "requestBody": { "content": { "image/jpeg": { "schema": { "example": ... , "format": "byte", "type": "string", "required": true, "description": "Base64 encoded JPEG image data, maximum payload size is 256 KB." } } }

},

But the module asks it to be a list type. _openapi3.errors.SpecError: Expected paths./playlists/{playlistid}/images.put.requestBody.content.image/jpeg.schema.required to be one of [<class 'list'>], got <class 'bool'>

How to solve this?

commonism commented 1 year ago

Use https://github.com/sonallux/spotify-web-api/blob/main/fixed-spotify-open-api.yml

   /playlists/{playlist_id}/images:
     get:
       description: 'Get the current image associated with a specific playlist.

         '
       operationId: get-playlist-cover
       parameters:
…
       requestBody:
         content:
           image/jpeg:
             schema:
               description: Base64 encoded JPEG image data, maximum payload size is
                 256 KB.
               example: /9j/2wCEABoZGSccJz4lJT5CLy8vQkc9Ozs9R0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0cBHCcnMyYzPSYmPUc9Mj1HR0dEREdHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR//dAAQAAf/uAA5BZG9iZQBkwAAAAAH/wAARCAABAAEDACIAAREBAhEB/8QASwABAQAAAAAAAAAAAAAAAAAAAAYBAQAAAAAAAAAAAAAAAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAARAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwAAARECEQA/AJgAH//Z
-              format: byte
-              required: true
+              format: base64
               type: string
+        required: true