Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"execa": "^5.1.1",
"figures": "^3.2.0",
"js-yaml": "^4.1.0",
"json-schema-to-ts": "^2.9.2",
"lodash.camelcase": "^4.3.0",
"lodash.deburr": "^4.1.0",
"lodash.setwith": "^4.3.2",
Expand Down
8 changes: 1 addition & 7 deletions packages/api/src/codegen/languages/typescript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,6 @@ export default class TSGenerator extends CodeGenerator {
? `file:${path.relative(__dirname, path.dirname(require.resolve('@readme/api-core/package.json')))}`
: corePkg.version,
},
'json-schema-to-ts': {
dependencyType: 'production',
reason: 'Required for TypeScript type handling.',
url: 'https://npm.im/json-schema-to-ts',
version: '^2.9.2',
},
tsup: {
dependencyType: 'development',
reason: "Used for compiling your codegen'd SDK into code that can be used in JS environments.",
Expand Down Expand Up @@ -581,7 +575,7 @@ sdk.server('https://eu.api.example.com/v14');`),
const sourceFile = sourceDirectory.createSourceFile('types.ts', '');

sourceFile.addImportDeclarations([
{ defaultImport: 'type { FromSchema }', moduleSpecifier: 'json-schema-to-ts' },
{ defaultImport: 'type { FromSchema }', moduleSpecifier: '@readme/api-core/lib' },
{ defaultImport: '* as schemas', moduleSpecifier: './schemas' },
]);

Expand Down
5 changes: 5 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
"require": "./dist/errors/fetchError.cjs",
"import": "./dist/errors/fetchError.js"
},
"./lib": {
"require": "./dist/lib/index.cjs",
"import": "./dist/lib/index.js"
},
"./package.json": "./package.json"
},
"main": "dist/index.cjs",
Expand Down Expand Up @@ -46,6 +50,7 @@
"datauri": "^4.1.0",
"fetch-har": "^11.0.1",
"get-stream": "^6.0.1",
"json-schema-to-ts": "^2.9.2",
"json-schema-traverse": "^1.0.0",
"lodash.merge": "^4.6.2",
"oas": "^23.0.0",
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/lib/index.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this barrel file going to be an issue from a tree-shaking standpoint?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything in this file is used in @readme/api-core so i don't think anything would be treeshaken out.

Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { FromSchema } from 'json-schema-to-ts';

import getJSONSchemaDefaults from './getJSONSchemaDefaults.js';
import parseResponse from './parseResponse.js';
import prepareAuth from './prepareAuth.js';
import prepareParams from './prepareParams.js';
import prepareServer from './prepareServer.js';

export { getJSONSchemaDefaults, parseResponse, prepareAuth, prepareParams, prepareServer };
export { FromSchema, getJSONSchemaDefaults, parseResponse, prepareAuth, prepareParams, prepareServer };
2 changes: 1 addition & 1 deletion packages/core/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export default defineConfig((options: Options) => ({
...options,
...config,

entry: ['src/errors/fetchError.ts', 'src/index.ts'],
entry: ['src/errors/fetchError.ts', 'src/lib/index.ts', 'src/index.ts'],
silent: !options.watch,
}));
3 changes: 1 addition & 2 deletions packages/test-utils/sdks/alby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"prepare": "tsup"
},
"dependencies": {
"@readme/api-core": "file:../../../../../core",
"json-schema-to-ts": "^2.9.2"
"@readme/api-core": "file:../../../../../core"
},
"devDependencies": {
"tsup": "^7.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/sdks/alby/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { FromSchema } from 'json-schema-to-ts';
import type { FromSchema } from '@readme/api-core/lib';
import * as schemas from './schemas';

export type AmqpExternalRulePatch = FromSchema<typeof schemas.AmqpExternalRulePatch>;
Expand Down
3 changes: 1 addition & 2 deletions packages/test-utils/sdks/metrotransit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"prepare": "tsup"
},
"dependencies": {
"@readme/api-core": "file:../../../../../core",
"json-schema-to-ts": "^2.9.2"
"@readme/api-core": "file:../../../../../core"
},
"devDependencies": {
"tsup": "^7.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/sdks/metrotransit/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { FromSchema } from 'json-schema-to-ts';
import type { FromSchema } from '@readme/api-core/lib';
import * as schemas from './schemas';

export type Agency = FromSchema<typeof schemas.Agency>;
Expand Down
3 changes: 1 addition & 2 deletions packages/test-utils/sdks/operationid-quirks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"prepare": "tsup"
},
"dependencies": {
"@readme/api-core": "file:../../../../../core",
"json-schema-to-ts": "^2.9.2"
"@readme/api-core": "file:../../../../../core"
},
"devDependencies": {
"tsup": "^7.2.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/test-utils/sdks/optional-payload/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"prepare": "tsup"
},
"dependencies": {
"@readme/api-core": "file:../../../../../core",
"json-schema-to-ts": "^2.9.2"
"@readme/api-core": "file:../../../../../core"
},
"devDependencies": {
"tsup": "^7.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/sdks/optional-payload/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { FromSchema } from 'json-schema-to-ts';
import type { FromSchema } from '@readme/api-core/lib';
import * as schemas from './schemas';

export type UpdatePetWithFormFormDataParam = FromSchema<typeof schemas.UpdatePetWithForm.formData>;
Expand Down
3 changes: 1 addition & 2 deletions packages/test-utils/sdks/petstore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"prepare": "tsup"
},
"dependencies": {
"@readme/api-core": "file:../../../../../core",
"json-schema-to-ts": "^2.9.2"
"@readme/api-core": "file:../../../../../core"
},
"devDependencies": {
"tsup": "^7.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/sdks/petstore/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { FromSchema } from 'json-schema-to-ts';
import type { FromSchema } from '@readme/api-core/lib';
import * as schemas from './schemas';

export type ApiResponse = FromSchema<typeof schemas.ApiResponse>;
Expand Down
3 changes: 1 addition & 2 deletions packages/test-utils/sdks/readme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"prepare": "tsup"
},
"dependencies": {
"@readme/api-core": "file:../../../../../core",
"json-schema-to-ts": "^2.9.2"
"@readme/api-core": "file:../../../../../core"
},
"devDependencies": {
"tsup": "^7.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/sdks/readme/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { FromSchema } from 'json-schema-to-ts';
import type { FromSchema } from '@readme/api-core/lib';
import * as schemas from './schemas';

export type Apply = FromSchema<typeof schemas.Apply>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"prepare": "tsup"
},
"dependencies": {
"@readme/api-core": "file:../../../../../core",
"json-schema-to-ts": "^2.9.2"
"@readme/api-core": "file:../../../../../core"
},
"devDependencies": {
"tsup": "^7.2.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { FromSchema } from 'json-schema-to-ts';
import type { FromSchema } from '@readme/api-core/lib';
import * as schemas from './schemas';

export type GetAnythingMetadataParam = FromSchema<typeof schemas.GetAnything.metadata>;
Expand Down
3 changes: 1 addition & 2 deletions packages/test-utils/sdks/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"prepare": "tsup"
},
"dependencies": {
"@readme/api-core": "file:../../../../../core",
"json-schema-to-ts": "^2.9.2"
"@readme/api-core": "file:../../../../../core"
},
"devDependencies": {
"tsup": "^7.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/sdks/simple/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { FromSchema } from 'json-schema-to-ts';
import type { FromSchema } from '@readme/api-core/lib';
import * as schemas from './schemas';

export type Category = FromSchema<typeof schemas.Category>;
Expand Down
3 changes: 1 addition & 2 deletions packages/test-utils/sdks/star-trek/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"prepare": "tsup"
},
"dependencies": {
"@readme/api-core": "file:../../../../../core",
"json-schema-to-ts": "^2.9.2"
"@readme/api-core": "file:../../../../../core"
},
"devDependencies": {
"tsup": "^7.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/sdks/star-trek/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { FromSchema } from 'json-schema-to-ts';
import type { FromSchema } from '@readme/api-core/lib';
import * as schemas from './schemas';

export type AnimalBase = FromSchema<typeof schemas.AnimalBase>;
Expand Down