Skip to content
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

feat: CodeGeneratorのentryPointに直接OpenApi.Documentを指定可能にする #66

Merged
merged 6 commits into from
Dec 6, 2021

Conversation

tkow
Copy link
Contributor

@tkow tkow commented Dec 6, 2021

Summary

Nest.jsなどのspec json生成ツールと連携を簡単にするために、ファイル出力をせずにjsonフォーマットを直接受け入れられるようにしました。
server reload時の自動クライアント生成などを行うユースケースに有用です。

Test Plan

src/index.ts Outdated Show resolved Hide resolved
constructor(private readonly entryPoint: string, private option?: Option) {
this.rootSchema = Api.FileSystem.loadJsonOrYaml(entryPoint);
this.resolvedReferenceDocument = Api.ResolveReference.resolve(entryPoint, entryPoint, JSON.parse(JSON.stringify(this.rootSchema)));
constructor(private readonly entryPointOrDocument: string | Types.OpenApi.Document, private option?: Option) {
Copy link
Owner

Choose a reason for hiding this comment

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

@Himenon TOOD update interface

@tkow tkow changed the title feat: json formatを実行可能にする feat: CodeGeneratorのentryPointに直接OpenApi.Documentを指定可能にする Dec 6, 2021
apiClientGeneratorTemplate,
]);

expect(code).toMatchSnapshot();
Copy link
Owner

Choose a reason for hiding this comment

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

既存の手続きで生成したコードと比較するだけで良さそうです。

apiClientGeneratorTemplate,
]);

expect(code1).toBe(code2);
Copy link
Owner

Choose a reason for hiding this comment

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

🙏

@Himenon Himenon merged commit 53065b2 into Himenon:main Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants