generated from stijnvanhulle/template
-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Support
div
and other basic elements to be returned by `@kubb/…
…react`
- Loading branch information
1 parent
345ec73
commit fd3831e
Showing
11 changed files
with
171 additions
and
6 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@kubb/react": patch | ||
--- | ||
|
||
Support `div` and other basic elements to be returned by `@kubb/react` |
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
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
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,41 @@ | ||
export function ListPets() { | ||
const href = '/pets' | ||
|
||
return ( | ||
<div className="test"> | ||
hello world | ||
<a href={href}>Open get</a> | ||
<button type="button" onClick={(e) => console.log(e)}> | ||
Submit | ||
</button> | ||
</div> | ||
) | ||
} | ||
|
||
export function CreatePets() { | ||
const href = '/pets' | ||
|
||
return ( | ||
<div className="test"> | ||
hello world | ||
<a href={href}>Open post</a> | ||
<button type="button" onClick={(e) => console.log(e)}> | ||
Submit | ||
</button> | ||
</div> | ||
) | ||
} | ||
|
||
export function ShowPetById() { | ||
const href = '/pets/:petId' | ||
|
||
return ( | ||
<div className="test"> | ||
hello world | ||
<a href={href}>Open get</a> | ||
<button type="button" onClick={(e) => console.log(e)}> | ||
Submit | ||
</button> | ||
</div> | ||
) | ||
} |
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,41 @@ | ||
import transformers from '@kubb/core/transformers' | ||
import { URLPath } from '@kubb/core/utils' | ||
import type { PluginOas } from '@kubb/plugin-oas' | ||
import { createReactGenerator } from '@kubb/plugin-oas' | ||
import { useOperationManager } from '@kubb/plugin-oas/hooks' | ||
import { Const, File, Function } from '@kubb/react' | ||
import React from 'react' | ||
|
||
export const example3 = createReactGenerator<PluginOas>({ | ||
name: 'client-operation', | ||
Operation({ operation }) { | ||
const { getName, getFile } = useOperationManager() | ||
|
||
const client = { | ||
name: getName(operation, { type: 'function' }), | ||
file: getFile(operation, { extname: '.tsx' }), | ||
} | ||
|
||
return ( | ||
<File baseName={client.file.baseName} path={client.file.path} meta={client.file.meta}> | ||
<File.Source> | ||
<Function name={transformers.pascalCase(operation.getOperationId())} export> | ||
<Const name={'href'}>"{new URLPath(operation.path).URL}"</Const> | ||
<br /> | ||
<br /> | ||
return | ||
<div className="test"> | ||
hello world | ||
{` | ||
<a href={href}>Open ${operation.method}</a> | ||
`} | ||
<button type={'button'} onClick={(e) => console.log(e)}> | ||
Submit | ||
</button> | ||
</div> | ||
</Function> | ||
</File.Source> | ||
</File> | ||
) | ||
}, | ||
}) |
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
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