-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenApi #182
Comments
Hi! /**
* Create product
* @param product
* @RequestBody application/xml
* @RequestBody application/json
*/
@Post("/")
Create(@Body() product: Product) {
} You can also add what types can be returned from a controller method. Use decorator ProducesResponse /**
* Gets product by id
* @summary action test
* @remarks Awesomeness!
* @param {id} The product id
*/
@Get("/:id")
@ProducesResponse({ code: 200, type: Product, description: "Product found" })
@ProducesResponse({ code: 404, type: NotFoundResult, description: "Product has missing/invalid values" })
@ProducesResponse({ code: 500, description: "Oops! Can't create your product right now" })
GetById(@Param("id") id: string) {
return new Product();
} To declare more information in types and models you can add other JsDoc parameters /**
* Entity of product
*/
export class Product {
/**
* @summary Identifer of code
* @example 1
*/
id?: number;
/**
* @summary Array of test case
* @example [1,2,3]
*/
arr?: number[];
/**
* @summary Type of product
* @example {id:1}
*/
type?: ProductType;
/**
* @maximum 100
*/
count?: number;
}```
https://github.com/alosaur/alosaur.com/blob/main/docs/techniques/OpenAPI.md |
Oh, my bad I'm blind 😃... Should I copy the metadata folder where ProducesResponse is? Thanks. |
That would work: But I think it would have to be improved to this state import { ProducesResponse } from "https://deno.land/x/alosaur/openapi/mod.ts" |
Hey, i created my own openapi based on Alosaur:
But I would like to add parameters of any type: Request Body, Schemas, ...
example - https://petstore.swagger.io/
Is there example how to write it?
TO:
https://petstore.swagger.io/v2/swagger.json
Thanks.
The text was updated successfully, but these errors were encountered: