Skip to content

Commit

Permalink
Add prefix() function
Browse files Browse the repository at this point in the history
It can be used to prefix OpenAPI paths.
  • Loading branch information
akheron committed Jan 6, 2021
1 parent 7345205 commit 4121431
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
export { generate } from './generate'
import { OpenAPIV3 } from 'openapi-types'

export const prefix = (
prefix: string,
paths: OpenAPIV3.PathsObject
): OpenAPIV3.PathsObject =>
Object.fromEntries(
Object.entries(paths).map(([path, value]) => [prefix + path, value])
)

0 comments on commit 4121431

Please sign in to comment.