-
Notifications
You must be signed in to change notification settings - Fork 64
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
Documentation #75
Comments
You can build schema. Example: import { OpenApiBuilder, PathsObject, PathItemObject, ResponseObject } from "openapi3-ts";
import apiConfig from "./config";
const getUserResponse: ResponseObject = {
description: "Gets user info by user id.",
}
const user: PathItemObject = {
get: {
operationId: "user",
responses: {
"200": getUserResponse,
}
}
}
const paths: PathsObject = {
"/user": user,
}
const builder = OpenApiBuilder.create({
openapi: apiConfig.openAPIVersion,
info: {
title: apiConfig.title,
version: apiConfig.version,
description: apiConfig.description,
contact: apiConfig.contact,
},
paths,
servers: [
{
url: `${apiConfig.host}:${apiConfig.port}`,
},
],
});
builder.addPath("/articles", {
get: {
operationId: "articles",
responses: {
"200": {
description: "Gets all articles.",
},
},
parameters: [
{
name: "page",
in: "query",
},
],
},
});
export const definition = builder.getSpec(); // js object
export const definitionJson = builder.getSpecAsJson(); // json
export const definitionYaml = builder.getSpecAsYaml(); // yaml |
I mean yea. Kinda surprising that no-one has even tried to contribute documentation given that this project seems to have like 550k weekly installs |
Thanks for the time taken to prepare and example @svrakata (we can use it as the seed for minimal docs). |
The lack of documentation has now even made these comments out of date. |
So. someone who is trying to learn what all it can do and how to use it is responsible for creating documentation? |
Added some basic docs on PR #139 |
Very Poor documentation!
No example of how to use it.
@pjmolina please at least attach an example.
After searching a lot I got this code sandbox example.
https://codesandbox.io/s/olpj88zyly?file=/src/index.ts
The text was updated successfully, but these errors were encountered: