Skip to main content

OpenAPI

Documentation of routes in OpenAPI is done through annotations. Some of them allow SQListe to deduce information about procedures, and sometimes eliminate the need for certain details.

#Accepts

Defines the content format that the procedure will accept.

ArgumentTypeDescriptionOptionalDefault Value
MimestringMIME TypeNo

Examples:

#Accepts("application/json")
#Accepts(Mime = "application/json")

#Takes

Defines the content type that the procedure will accept. This annotation can be written multiple times for a single procedure to define multiple possible inputs.

ArgumentTypeDescriptionOptionalDefault Value
TypestringName of a type defined in the OpenAPI procedureYes""
RequiredboolTrue if requiredYesTrue
DescriptionstringDescription of the responseYes""

Examples:

#Takes("loginModel", true, "User login information")
#Takes(Type = "loginModel", Required = true, Description = "User login information")

#Produces

Defines the content format that the procedure will produce.

ArgumentTypeDescriptionOptionalDefault Value
MimestringMIME TypeNo

Examples:

#Produces("application/json")
#Produces(Mime = "application/json")
info

When #Produces is defined, you have the option to omit the response_content_type parameter. If it is not defined during the pipeline, SQListe will apply the MIME type of the first occurrence of #Produces found to the response.

Note: If the response_content_type parameter is provided at any point in the pipeline, it will take precedence.

#Responds

Defines the content type that the procedure will produce. This annotation can be written multiple times for a single procedure to define multiple possible outputs.

ArgumentTypeDescriptionOptionalDefault Value
TypestringName of a type defined in the OpenAPI procedureYes""
StatusstringHTTP status of the responseYes200 OK
DescriptionstringDescription of the responseYes""

Examples:

#Responds("applicationMessage", 200, "Returns a message to display to the user")
#Responds(Type = "applicationMessage", Status = 200, Description = "Returns a message to display to the user")

Please note that you can copy and paste this content directly into a Markdown file.