Forum Discussion

BostonKevin's avatar
6 years ago

JSON Payload Not Present in curl Command Generated by Swagger Inspector

In an API that I am documenting with Swagger Editor, there is a JSON payload that must be passed when a POST operation is performed.  I can document the JSON payload quite well with Swagger Editor, as shown below:


        - name: translation_block
          in: body
          description: The translation block consists of block_hash, target, and the translation source.
          required: true
          style: simple
          explode: false
            type: object
              - block_hash
              - target
              - translation_source
                type: string
                description: The block hash.
                example: 1234567899
                type: object
                  - text
                    type: string
                    description: The translation of the origin text to the target language. 
                    example: "La blanquette de veau est excellente."
                type: string
                description: The source of the translated text.
                example: wordfast  
          example: 12345678

In Swagger Inspector, the JSON payload appears as expected:



But when I click Execute to test against the API, the JSON payload that I have defined does not appear in the curl command that Swagger Inspector generates.  I was able to add `--data` followed by the payload to the curl command and got it to work, but it would be helpful to the developers if Swagger Inspector would generate the rest of the curl statement.  Using the examples above, the curl statement to be generated by Swagger Inspector would be as follows:


curl -X POST "http://localhost:6060/xapis/BlockTranslation/2B66-3D77-AC7F-EE58?user_key=59C0-75D5-4D39-46B8" --data '[{"block_hash":"1234567899", "target":[{"text":"La  La blanquette de veau est excellente."}],"translation_source":"wordfast"}]'


No RepliesBe the first to reply