Skip to content
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

feature: ability to add Entity properties that related to Open API #360

Open
davidmeirlevy opened this issue Mar 6, 2024 · 3 comments
Open

Comments

@davidmeirlevy
Copy link

consider this ability on an entity:

@Entity('products', {
  openApi:  {
    // added data to open API json regarding the entity
  }
})
export class Product {
  ...
}

what do you think?

@yoni-rapoport
Copy link
Collaborator

Can you give an example of what kind of data should be added this way?

@davidmeirlevy
Copy link
Author

Let's say I want to add: summary, description, servers (dev / staging / prod), externalDocs, or to mention additional body or headers to the requests that aren't mentioned inside the entity (like a middleware that checks different kind of authentication methods that running outside of remult).

@noam-honig
Copy link
Collaborator

You can do that today, by extending remult EntityOptions etc.... see:
https://remult.dev/docs/custom-options.html

And then process the openApi json file before sending it to swagger:

const openApiDocument = api.openApiDoc({ title: "remult-react-todo" });
// --> process the json here. to add what you want based on the options you extend
app.get("/api/openApi.json", (req, res) => res.json(openApiDocument));
app.use('/api/docs', swaggerUi.serve, swaggerUi.setup(openApiDocument));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants