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

Inconsistent knownMediaType produced for "type": "string", "format": "binary" json values #3631

Closed
pakrym opened this issue Oct 21, 2020 · 1 comment · Fixed by Azure/autorest.modelerfour#363
Assignees
Labels
Modeler P1 - Required Required functionality - not blocking

Comments

@pakrym
Copy link
Contributor

pakrym commented Oct 21, 2020

{
  "swagger": "2.0",
  "info": {
    "title": "JsonAsBinary",
    "description": "JsonAsBinary",
    "version": "1.0.0"
  },
  "host": "localhost:3000",
  "schemes": [
    "http"
  ],
  "produces": [
    "application/json"
  ],
  "consumes": [
    "application/json"
  ],
  "paths": {
    "/Operation/": {
      "put": {
        "operationId": "Operation",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "schema": {
              "type": "string",
              "format": "binary"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "schema": {
              "type": "string",
              "format": "binary"
            }
          }
        }
      }
    }
  }
}
       protocol: !<!Protocols> 
              http: !<!HttpWithBodyRequest> 
                path: /Operation/
                method: put
                knownMediaType: json <----------
                mediaTypes:
                  - application/json
                uri: '{$host}'
        signatureParameters: []
        responses:
          - !<!BinaryResponse> 
            binary: true
            language: !<!Languages> 
              default:
                name: ''
                description: ''
            protocol: !<!Protocols> 
              http: !<!HttpBinaryResponse> 
                knownMediaType: binary <----------
                mediaTypes:
                  - application/json
                statusCodes:
                  - '200'
@daviwil
Copy link
Contributor

daviwil commented Oct 21, 2020

Basically the request here is to add support for having a consumes of application/json which can have a parameter of type: string, format: binary (or type: file, format: object in Swagger) which produces a code model that sets KnownMediaType: binary for the parameter to be expressed as a stream even though the service expects JSON.

@daviwil daviwil transferred this issue from Azure/autorest.modelerfour Nov 9, 2020
@daviwil daviwil added P1 - Required Required functionality - not blocking Modeler labels Nov 9, 2020
@timotheeguerin timotheeguerin self-assigned this Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Modeler P1 - Required Required functionality - not blocking
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants