How to Write Input Check Information to the Swagger YAML

Asked 1 years ago, Updated 1 years ago, 439 views

I am making a swagger-style YAML with OpenAPI 3.0, but I am having trouble writing input check information for the API.
Please let me know which block and which properties I should use.

yaml openapi swagger

2022-09-30 21:54

1 Answers

The minimum, maximum, and limitations of input items are described in the Schema Object.

For number/integer/string, data type definitions can be subdivided using the format field.

Here's a simple example:

 schema:
  type:object
  properties:
    comment:
      type:string
      minimum —0# Minimum 0 characters 
      maximum : 10 # up to 10 characters 
    updateAt:
      type:string
      format:date# Date format according to RFC 3339


2022-09-30 21:54

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.