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(api): creating LICENSE files and and SDK headings #786

Merged
merged 5 commits into from
Oct 25, 2023

Conversation

erunion
Copy link
Member

@erunion erunion commented Oct 25, 2023

🚥 Resolves RM-8225

🧰 Changes

  • Creates a new LICENSE file in the codegen'd SDK directory if we're able to recognize a license in their OpenAPI definition info.license object.
  • Adding a license property to the package.json file if we have a recognized license.
  • Fill out a docblock on the main SDK class containing various pieces of data from their OpenAPI definition info object including: title, description, and termsOfService

This is what it all looks like on a fully specced out definition:

Screen Shot 2023-10-24 at 5 02 24 PM

@erunion erunion added enhancement New feature or request area:core Issues related to `core`, which is the package that powers the SDKs at runtime labels Oct 25, 2023
@@ -510,6 +514,10 @@ sdk.server('https://eu.api.example.com/v14');`),
tsup: tsupOptions as JsonObject,
};

if (!this.spdxLicense) {
delete pkg.license;
Copy link
Member Author

Choose a reason for hiding this comment

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

Doing this instead of adding license to pkg here because I like having license slotted into the object where it is instead of after tsup. 💅

Comment on lines 12 to 13
* Detailed information on using this API can be found in the Ably <a
* href="https://ably.com/documentation/control-api">developer documentation</a>.
Copy link
Member Author

Choose a reason for hiding this comment

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

Annoying that they have HTML elements in this but I don't really have any desire to pull in a Markdown parser to convert these.

@erunion erunion marked this pull request as ready for review October 25, 2023 00:38
@erunion erunion added this to the v7 milestone Oct 25, 2023
@erunion erunion changed the title feat(api): creating LICENSE files and adding info objects to SDK docblocks feat(api): creating LICENSE files and and SDK class headings Oct 25, 2023
@erunion erunion changed the title feat(api): creating LICENSE files and and SDK class headings feat(api): creating LICENSE files and and SDK headings Oct 25, 2023
packages/test-utils/sdks/petstore/src/index.ts Outdated Show resolved Hide resolved
packages/test-utils/sdks/petstore/LICENSE Show resolved Hide resolved
packages/api/src/storage.ts Show resolved Hide resolved
packages/api/src/codegen/languages/typescript/index.ts Outdated Show resolved Hide resolved
packages/test-utils/sdks/petstore/src/index.ts Outdated Show resolved Hide resolved
packages/api/package.json Show resolved Hide resolved
packages/test-utils/sdks/petstore/LICENSE Outdated Show resolved Hide resolved
@@ -97,22 +97,16 @@ function assertSDKFixture(file: string, fixture: string) {

describe('typescript', () => {
beforeEach(() => {
vi.setSystemTime(new Date('2023'));
Copy link
Member Author

Choose a reason for hiding this comment

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

Had to change this to a fuller date because new Date('2023').getFullYear() returns 2022.

Comment on lines +109 to 113
/**
* Quirky `operationID` cases
*
*/
const createSDK = (() => { return new SDK(); })();
Copy link
Member Author

Choose a reason for hiding this comment

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

Moving these docblocks from the SDK class to this export caused them to get surfaced:

screen_shot_2023-10-25_at_10 02 38_am

Copy link
Member

@kanadgupta kanadgupta left a comment

Choose a reason for hiding this comment

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

a few tiny nits but otherwise LGTM!

packages/api/src/codegen/codegenerator.ts Outdated Show resolved Hide resolved
packages/api/src/codegen/languages/typescript/index.ts Outdated Show resolved Hide resolved
@erunion erunion merged commit 521683a into main Oct 25, 2023
5 checks passed
@erunion erunion deleted the feat/sdk-licenses branch October 25, 2023 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core Issues related to `core`, which is the package that powers the SDKs at runtime enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants