-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
676 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { defineConfig } from "@workleap/create-schemas"; | ||
import { openapiFetchPlugin } from "@workleap/create-schemas/plugins"; | ||
import { openapiFetchPlugin, unstable_openapiMSWPlugin } from "@workleap/create-schemas/plugins"; | ||
|
||
export default defineConfig({ | ||
input: "v1.yaml", | ||
outdir: "src/codegen/v1", | ||
plugins: [openapiFetchPlugin()] | ||
plugins: [openapiFetchPlugin(), unstable_openapiMSWPlugin()] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
/** Do not modify. This file has been generated by @workleap/create-schemas */ | ||
/** This file has been generated by @workleap/create-schemas (https://github.com/gsoft-inc/wl-openapi-typescript). Do not modify manually. */ | ||
import type { paths } from "./types.ts"; | ||
import _createClient from "openapi-fetch"; | ||
|
||
export const createClient = _createClient as typeof _createClient<paths, "application/json">; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** This file has been generated by @workleap/create-schemas (https://github.com/gsoft-inc/wl-openapi-typescript). Do not modify manually. */ | ||
import type { paths } from "./types.ts"; | ||
import { createOpenApiHttp } from "openapi-msw"; | ||
export const http = createOpenApiHttp<paths>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export type { Plugin } from "./plugin.ts"; | ||
export { openapiFetchPlugin } from "./openapi-fetch-plugin.ts"; | ||
export { openapiFetchPlugin } from "./openapi-fetch-plugin.ts"; | ||
export { unstable_openapiMSWPlugin } from "./openapi-msw-plugin.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import type { Plugin } from "./plugin.ts"; | ||
import { getRelativeModuleResolutionExtension } from "../utils.ts"; | ||
import { openapiTypeScriptId } from "./openapi-typescript-plugin.ts"; | ||
|
||
export function unstable_openapiMSWPlugin(): Plugin { | ||
return { | ||
name: "openapi-fetch-plugin", | ||
async transform({ id, emitFile }) { | ||
if (id !== openapiTypeScriptId) { | ||
return; | ||
} | ||
|
||
const importsFileExtension = getRelativeModuleResolutionExtension(); | ||
|
||
emitFile({ | ||
filename: "openapi-msw.ts", | ||
code: [ | ||
`import type { paths } from "./types${importsFileExtension}";`, | ||
"import { createOpenApiHttp } from \"openapi-msw\";", | ||
"export const http = createOpenApiHttp<paths>();" | ||
].join("\n") | ||
}); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.