Skip to content

add v1 and v2 config and generate initial output #14

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 1 commit into from
May 5, 2025

Conversation

gumaerc
Copy link
Contributor

@gumaerc gumaerc commented May 5, 2025

What are the relevant tickets?

Related to https://github.com/mitodl/hq/issues/7250

Description (What does it do?)

Now that the v1 and v2 spec have been added to the settings in mitxonline, we need to generate and commit the initial output of these endpoints to this repo.

How can this be tested?

You should be able to clone the repo and run ./scripts/generate.sh without issue

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @gumaerc, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request adds the v1 and v2 configurations for generating the initial output of the MITx Online API clients using the OpenAPI generator. It includes the YAML configuration files for typescript-axios generator for both v1 and v2 specs, and updates the generator version. Additionally, there are some changes in the generated v0 client, including a change in the enum type for CompanySizeEnum, making partner_school optional, removing Null: 'null' from NullEnum, and some changes in the function parameters for API calls.

Highlights

  • Configuration: Adds YAML configuration files for generating typescript-axios clients for v1 and v2 OpenAPI specs.
  • Generator Version Update: Updates the OpenAPI generator version from 7.2.0 to 7.9.0 for v0, v1 and v2 clients.
  • API Changes: Modifies the generated v0 client, including enum type changes and making partner_school optional.
  • Function Parameter Changes: Updates function parameters in the generated v0 client to use localVarOperationServerBasePath instead of operationBasePath.

Changelog

Click here to see the changelog
  • config/typescript-axios-v1.yaml
    • Adds a new YAML configuration file for generating typescript-axios client for v1 OpenAPI spec.
  • config/typescript-axios-v2.yaml
    • Adds a new YAML configuration file for generating typescript-axios client for v2 OpenAPI spec.
  • src/typescript/mitxonline-api-axios/src/v0/.openapi-generator/VERSION
    • Updates the OpenAPI generator version from 7.2.0 to 7.9.0.
  • src/typescript/mitxonline-api-axios/src/v0/api.ts
    • Changes the enum type for CompanySizeEnum from string to number.
    • Makes the partner_school property optional in the LearnerProgramRecordShare interface.
    • Removes Null: 'null' from the NullEnum.
    • Updates function parameters for API calls to use localVarOperationServerBasePath instead of operationBasePath.
  • src/typescript/mitxonline-api-axios/src/v1/.openapi-generator/FILES
    • Adds a new file listing the generated files for v1 client.
  • src/typescript/mitxonline-api-axios/src/v1/.openapi-generator/VERSION
    • Adds a new file specifying the OpenAPI generator version for v1 client (7.9.0).
  • src/typescript/mitxonline-api-axios/src/v1/base.ts
    • Adds a new base.ts file for v1 client.
  • src/typescript/mitxonline-api-axios/src/v1/common.ts
    • Adds a new common.ts file for v1 client.
  • src/typescript/mitxonline-api-axios/src/v1/configuration.ts
    • Adds a new configuration.ts file for v1 client.
  • src/typescript/mitxonline-api-axios/src/v1/index.ts
    • Adds a new index.ts file for v1 client.
  • src/typescript/mitxonline-api-axios/src/v2/.openapi-generator/FILES
    • Adds a new file listing the generated files for v2 client.
  • src/typescript/mitxonline-api-axios/src/v2/.openapi-generator/VERSION
    • Adds a new file specifying the OpenAPI generator version for v2 client (7.9.0).
  • src/typescript/mitxonline-api-axios/src/v2/base.ts
    • Adds a new base.ts file for v2 client.
  • src/typescript/mitxonline-api-axios/src/v2/common.ts
    • Adds a new common.ts file for v2 client.
  • src/typescript/mitxonline-api-axios/src/v2/configuration.ts
    • Adds a new configuration.ts file for v2 client.
  • src/typescript/mitxonline-api-axios/src/v2/index.ts
    • Adds a new index.ts file for v2 client.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


Specs align, code takes flight,
API clients, shining bright,
V1, V2 arise,
Clean interfaces, no lies,
MITx Online, pure delight.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gumaerc gumaerc added the Needs Review An open Pull Request that is ready for review label May 5, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces v1 and v2 configurations for generating API clients and updates the generator version. The changes look good overall, but there are a few areas that could be improved for clarity and consistency.

Summary of Findings

  • Consistent Naming for Server Index Variables: In api.ts, the variable names for server index and base path are not consistently named across different API functions. Standardizing these names would improve readability.
  • Enum Type Definition: In api.ts, the enum YearsExperienceEnum is defined as number in v0, but as string in v1 and v2. This inconsistency should be addressed.

Merge Readiness

The pull request is almost ready for merging. Addressing the naming inconsistencies and enum type definition would improve the code quality and maintainability. I am unable to directly approve this pull request, and recommend that others review and approve this code before merging. I recommend that the pull request not be merged until the above are addressed.

Comment on lines 61 to +62
* @export
* @enum {string}
* @enum {number}

Choose a reason for hiding this comment

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

medium

The enum CompanySizeEnum is defined as number here, but as string in v1 and v2. Should this be consistent across all versions?

@@ -922,7 +922,6 @@ export type NodeTypeEnum = typeof NodeTypeEnum[keyof typeof NodeTypeEnum];
*/

export const NullEnum = {
Null: 'null'
} as const;

Choose a reason for hiding this comment

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

medium

Is it correct that NullEnum is empty?

Comment on lines +2617 to 2618
* @enum {number}
*/

Choose a reason for hiding this comment

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

medium

The enum YearsExperienceEnum is defined as number here, but as string in v1 and v2. Should this be consistent across all versions?

Copy link

@jkachel jkachel left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@gumaerc gumaerc merged commit 9789e62 into main May 5, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review An open Pull Request that is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants