Skip to content

Commit

Permalink
fix: apipgen-swag-ts uri get to json error
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr.Mao committed Feb 24, 2023
1 parent a5f18db commit f142f16
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 6 deletions.
3 changes: 1 addition & 2 deletions apipgen.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { defineConfig } from 'apipgen'
import source from './example'

const config = defineConfig({
pipeline: 'swag-ts',
input: {
json: source as Record<string, any>,
uri: 'https://petstore.swagger.io/v2/swagger.json',
},
output: {
main: 'dist-test/index.ts',
Expand Down
8 changes: 8 additions & 0 deletions packages/apipgen/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# apipgen

## 0.2.5

### Patch Changes

- Updated dependencies
- [email protected]
- [email protected]

## 0.2.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/apipgen/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apipgen",
"version": "0.2.4",
"version": "0.2.5",
"description": "Generator Api",
"author": "Hairy",
"license": "ISC",
Expand Down
7 changes: 7 additions & 0 deletions packages/swag-js/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# apipgen-swag-js

## 0.0.5

### Patch Changes

- Updated dependencies
- [email protected]

## 0.0.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/swag-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apipgen-swag-js",
"version": "0.0.4",
"version": "0.0.5",
"description": "",
"main": "src/index.ts",
"scripts": {
Expand Down
6 changes: 6 additions & 0 deletions packages/swag-ts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# apipgen-swag-ts

## 0.0.4

### Patch Changes

- fix: apipgen-swag-ts uri get to json error

## 0.0.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/swag-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apipgen-swag-ts",
"version": "0.0.3",
"version": "0.0.4",
"description": "",
"main": "src/index.ts",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions packages/swag-ts/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ function prefix(path: string) {
}

function readJson(json: string | Record<string, any>): Record<string, any> | undefined {
if (!json)
return
if (typeof json === 'object')
return json
else
Expand Down
2 changes: 1 addition & 1 deletion packages/swag-ts/src/parser/utils/collects/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function getFunctionOptions(pathParams: PathParameters) {
}

config.parameters.push({
type: 'import("axios").AxiosRequestConfig',
type: 'AxiosRequestConfig',
name: 'config',
required: false,
})
Expand Down

0 comments on commit f142f16

Please sign in to comment.