Skip to content

Commit

Permalink
chore: allow coerce in url params (#1)
Browse files Browse the repository at this point in the history
Co-authored-by: alex hamilton <[email protected]>
  • Loading branch information
miltonian and alex hamilton authored Jul 24, 2024
1 parent 23a37bd commit 4cddc7b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/openAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@ export function buildOpenAPIDocument(args: {
for (const method of Object.keys(impl)) {
for (const param of impl[method].parameters || []) {
if (param.required === false && param.in === "path") {
throw new Error(
`OpenAPI Error: The route ${route} has an optional parameter ${param.name} in the path. ` +
param.required = true;
console.warn(
`OpenAPI Warning: The route ${route} has an optional parameter ${param.name} in the path. ` +
`Optional parameters in the route path are not supported by readme.io. Make the parameter required ` +
`or split the route definition into two separate ones, one with the param and one without.`,
);
Expand Down

0 comments on commit 4cddc7b

Please sign in to comment.