Skip to content

Proposed format: jsonObject and jsonArray to type: string #552

Closed
@deefactorial

Description

@deefactorial

Here is the problem:

I'm lacking the tools to fully validate the response of an API end point of 3rd party middleware. The middleware is passportJS and the response is JSON.stringified before being sent. The only way I've found to validate the response is to say that it's a string and perhaps provide a regex to the string. But what I would really like to do is JSON.parse the string and validate the contents of the string.

What is the proper way to define an response to do so ?

Perhaps there is a way to do it with the 2.0 spec. If there isn't a way I would like to propose a format: jsonObject and format: jsonArray added to the type: string

proposed format: jsonObject:

definitions:
  token_response:
    type: string
    format: jsonObject
    minProperties: 2
    maxProperties: 5
    required:
      - access_token
      - expires
    properties:
      access_token:
        type: string
      expires:
        type: string

proposed format: jsonArray

definitions:
  list_response:
    type: string
    format: jsonArray
    items:
      type: string

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions