postman-to-openapi icon indicating copy to clipboard operation
postman-to-openapi copied to clipboard

Allow directly add any json to schema

Open joolfe opened this issue 4 years ago • 3 comments

Using some kind of merging strategy allow customization just in case some feature is missing. or for non standard schemas.

joolfe avatar Oct 08 '20 10:10 joolfe

Hi @joolfe, I have similar problem, I support to use markdown table to describe the json request body, and transform the table to swagger format. I'm not sure this issue is same as my comment, but I will try to explain...

For example: write the md table in postman documentation as below

name description required type
message notify message true string
user Group of the user true object
user.id Group of the user id true number
user.name Group of the user name true string
user.info Group of the user info true object
user.info.address Group of the user address true string
final Group is final true boolean

and then transform the table to swagger format like as

      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                message:
                  type: string
                  description: notify message
                user:
                  type: object
                  properties:
                    id:
                      type: number
                      description: Group of the user id
                    name:
                      type: string
                      description: Group of the user name
                    info:
                      type: object
                      properties:
                        address:
                          type: string
                          description: Group of the user address
                      required:
                        - address
                      description: Group of the user info
                  required:
                    - id
                    - name
                    - info
                  description: Group of the user
                final:
                  type: boolean
                  description: Group of the final
              required:
                - message
                - user
                - final

I already implement this feature, and doing unit test now... if it is possible, I can push merge request.

Thanks BestRegard

Chia-Yu-hung avatar Aug 11 '21 17:08 Chia-Yu-hung

hi @Chia-Yu-hung,

thanks but this feature is not for markdown, the idea is to allow to merge a input json with the resulted yml so anything can be overwrite as for example schemas or whatever

Best Regards

joolfe avatar Aug 14 '21 16:08 joolfe

Hi @joolfe, Thank for your reply. I'll create other issue~

Best Regards

Chia-Yu-hung avatar Aug 15 '21 04:08 Chia-Yu-hung