Skip to content

feat: add multiple file support #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 13, 2018
Merged

feat: add multiple file support #6

merged 2 commits into from
Dec 13, 2018

Conversation

scink
Copy link
Contributor

@scink scink commented Dec 7, 2018

Closes #2

BREAKING CHANGE: pathToSpec renamed to pathsToSpec and it is string[] now instead of string

Closes #2

BREAKING CHANGE: `pathToSpec` renamed to `pathsToSpec` and it is `string[]` now instead of `string`
@scink scink added the enhancement New feature or request label Dec 7, 2018
@scink scink requested a review from raveclassic December 7, 2018 10:01
@scink scink mentioned this pull request Dec 7, 2018
@scink
Copy link
Contributor Author

scink commented Dec 10, 2018

@raveclassic, please review this PR

package.json Outdated
@@ -6,7 +6,7 @@
"scripts": {
"ts-node": "ts-node",
"tslint": "tslint -c tslint.json --project tsconfig.json './src/**/*.ts' './test/**/*.ts'",
"test": "npm run tslint && npm run prettier && ts-node ./test/index.ts",
"test": "rm -rf ./test/out && npm run tslint && npm run prettier && ts-node ./test/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.

Won't work in cmd. You can add rimraf to dependencies and use it as cli.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i used del

src/index.ts Outdated
};
};

const decode = (json: TJSON): Either<ValidationError[], TSwaggerObject> => {
Copy link
Contributor

Choose a reason for hiding this comment

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

unnecessary function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

src/index.ts Outdated
fileName: string;
};

const read = async (_pathToFile: string): Promise<TBuffer> => {
Copy link
Contributor

Choose a reason for hiding this comment

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

please don't use _naming

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -218,10 +220,29 @@ const serializePath = (url: string, item: TPathItemObject, rootName: string, cwd
const serializeSchemaObject = (schema: TSchemaObject, rootName: string, cwd: string): TSerializedType => {
switch (schema.type) {
case undefined: {
const type = `${schema.$ref.replace(/^#\/definitions\//g, '')}`;
const $ref = schema.$ref;
const defBlock = fromNullable($ref.match(/#\/[^\/]+\//))
Copy link
Contributor

Choose a reason for hiding this comment

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

What are you trying to achieve here? I believe everything can be rewritten with a single match

Copy link
Contributor Author

Choose a reason for hiding this comment

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

replaced with a single match

@@ -0,0 +1,182 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Default identation for json files is 2 spaces. See .editorconfig

Copy link
Contributor Author

@scink scink Dec 13, 2018

Choose a reason for hiding this comment

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

there is nothing about json in the .editorconfig
but i changed it to 2 spaces

@scink scink merged commit acd1c2a into master Dec 13, 2018
@scink scink deleted the multifile-support branch December 13, 2018 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants