Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Swagger return value description

Shulou Source: shulou.com Published: 2022-06-03 08:11:49 10月02日 Update

Today, I was scolded by the front end and panicked, saying that the interface you wrote and what the return value was, there were only three public fields.

Our API documents are written based on swagger components. If you have the following things

Example:

1.1. Return to field 1.1.1. Returns the field (object) 1. The existing interface @ ApiOperation is annotated and the response field is removed.

The purpose of this field is to declare a specified return value object

After modification:

two。 Return objects for generic declaration

After declaration, swagger will reflect and generate the field description of the object.

3. Use the @ ApiModelPropety annotation to indicate the meaning of the field

@ ApiModelProperty ("XXX")

Example:

1.1.2. Return field (single field)

For a single field and less than 5 fields, the return value can be described in this way

1.2. Request field 1.2.1. Request field (object)

The interface input parameter is declared to be received by the object

Object fields are annotated with @ ApiParam annotation

1.2.2. Request field (single field or multiple fields)

Single or multiple fields are marked with @ ApiImplicitParams @ ApiImplicitParam

Tags: Fields objects interfaces annotations examples three things stockings functions front end only meaning document mode components facet reflection generation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Microsoft Xiaomi Shulou Technology MariaDB