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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing configs #10175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

aaqilniz
Copy link
Contributor

@aaqilniz aaqilniz commented Nov 11, 2023

Here is the reason why I've made these changes.

We have three ways to pass options to a generator.

  1. the default values
  2. Passing individual argument
  3. passing through the configuration object (json object)

I will take the discoverer as an example.

It has an option views with the default value of true. The generator fails to assign the value of the views from the config object as in the base-generator, the condition would always be true. The object this.options will have the views set to true (the default). This is the line if (!this.options[o]) {.

Please note that this happens only when a generator has an option with the default value being truthy (views in discoverer & server option in openapi generator)

Checklist

  • DCO (Developer Certificate of Origin) signed in all commits
  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

馃憠 Check out how to submit a PR 馃憟

@coveralls
Copy link

coveralls commented Nov 11, 2023

Pull Request Test Coverage Report for Build 7781694227

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall first build on fix/configs at 55.415%

Totals Coverage Status
Change from base Build 7776209974: 55.4%
Covered Lines: 9568
Relevant Lines: 12457

馃挍 - Coveralls

@dhmlau
Copy link
Member

dhmlau commented Dec 15, 2023

@aaqilniz, is this PR ready for review? The changes LGTM.

@aaqilniz
Copy link
Contributor Author

aaqilniz commented Jan 28, 2024

Hi, @dhmlau. The PR is finally ready.

Here is the reason why I've made these changes.

We have three ways to pass options to a generator.

  1. the default values
  2. Passing individual argument
  3. and passing through configuration object (json object)

I will take the discoverer as an example.

It has an option views with the default value of true. The generator fails to assign the views value from the config object as in the base-generator, the condition would always be true. The object this.options will have the views set to true (the default). This is the line if (!this.options[o]) {.

Please note that this happens only when a generator has an option with the default value being truthy (views in discoverer & server option in openapi generator)

@aaqilniz aaqilniz marked this pull request as ready for review January 28, 2024 08:13
Signed-off-by: Muhammad Aaqil <aaqilcs102@gmail.com>
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

3 participants