0

I have a React app that save a dictionary and each key is an shortId and the value is an object. look like that

{
 'abcd1234':{ip:'1.1.1.1', c_type: 1},
 '9876fedc':{ip:'2.2.2.2', c_type: 2},
}

I tried to build objects in openApi yaml for the backend post request that represent those models that get from the app. But, I don't find a way to define it the only thing that I success to create is to get a list of id and the object itself, for example:

[{id: 'abcd1234',ip:'1.1.1.1', c_type: 1},
 {id: '9876fedc', ip:'2.2.2.2', c_type: 2},]

need help to understand how to define the yaml that openApi can validate my post request that get the same structure like that

    Con:
      type: object
      required:
        - ip
        - c_type
      properties:
        ip:
          type: string
          example: 1.1.1.1
        c_type:
          type: integer
          example: 2
    ConDict:
      type: object
      properties:
        id: string
        ????

Thanks :)

  • `ConDict` needs to use `additionalProperties` instead of `properties` - check the linked answers for syntax examples. – Helen Jan 17 '22 at 10:35

0 Answers0