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

remove unnecessary bool enums #12192

Merged
merged 2 commits into from
Jan 8, 2021
Merged

Conversation

iscai-msft
Copy link
Contributor

@iscai-msft iscai-msft commented Dec 21, 2020

no point in having these bool enums, also causing issues in generated code

see Azure/autorest.python#847 for generated code issue

@openapi-workflow-bot
Copy link

Hi, @iscai-msft Thanks for your PR. I am workflow bot for review process. Here are some small tips.

  • Please ensure to do self-check against checklists in first PR comment.
  • PR assignee is the person auto-assigned and responsible for your current PR reviewing and merging.
  • For specs comparison cross API versions, Use API Specs Comparison Report Generator
  • If there is CI failure(s), to fix CI error(s) is mandatory for PR merging; or you need to provide justification in PR comment for explanation. How to fix?

  • Any feedback about review process or workflow bot, pls contact swagger and tools team. vsswagger@microsoft.com

    @openapi-pipeline-app
    Copy link

    openapi-pipeline-app bot commented Dec 21, 2020

    Swagger Validation Report

    ️️✔️BreakingChange succeeded [Detail] [Expand]
    There are no breaking changes.

    ️️✔️LintDiff succeeded [Detail] [Expand]
    Validation passes for LintDiff.

    ️️✔️Avocado succeeded [Detail] [Expand]
    Validation passes for Avocado.
    ️️✔️ModelValidation succeeded [Detail] [Expand]
    Validation passes for ModelValidation.
    ️️✔️SemanticValidation succeeded [Detail] [Expand]
    Validation passes for SemanticValidation.
    ️️✔️[Staging] Cross Version BreakingChange (Base on preview version) succeeded [Detail] [Expand]
    There are no breaking changes.
    ️️✔️[Staging] Cross Version BreakingChange (Base on stable version) succeeded [Detail] [Expand]
    There are no breaking changes.
    ️️✔️CredScan succeeded [Detail] [Expand]
    There is no credential detected.
    Posted by Swagger Pipeline | How to fix these errors?

    @openapi-pipeline-app
    Copy link

    openapi-pipeline-app bot commented Dec 21, 2020

    Swagger Generation Artifacts

    ️️✔️ azure-sdk-for-js succeeded [Detail] [Expand]
    • ️✔️Succeeded [Logs]Release - Generate from bac7543. SDK Automation 14.0.0
      warn	Skip initScript due to not configured
      command	autorest --version=V2 --typescript --license-header=MICROSOFT_MIT_NO_VERSION --use=@microsoft.azure/autorest.typescript@4.4.4 --typescript-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-js/azure-sdk-for-js ../../azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md
    • ️✔️@azure/arm-kubernetesconfiguration [View full logs]  [Release SDK Changes]
      cmderr	[npmPack] loaded rollup.config.js with warnings
      cmderr	[npmPack] (!) Unused external imports
      cmderr	[npmPack] default imported from external module 'rollup' but never used
      cmderr	[npmPack] ./esm/sourceControlConfigurationClient.js → ./dist/arm-kubernetesconfiguration.js...
      cmderr	[npmPack] created ./dist/arm-kubernetesconfiguration.js in 154ms
    ️️✔️ azure-resource-manager-schemas succeeded [Detail] [Expand]
    • ️✔️Succeeded [Logs]Release - Generate from bac7543. Schema Automation 14.0.0
      warn	Skip initScript due to not configured
      command	npx n 12
      command	autorest --use=@autorest/azureresourceschema@3.0.92 --version=3.0.6320 --azureresourceschema --multiapi --title=none --pass-thru:subset-reducer --azureresourceschema-folder=/home/vsts/work/1/s/azure-resource-manager-schemas/azure-resource-manager-schemas ../../azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md
    • ️✔️kubernetesconfiguration [View full logs]  [Release Schema Changes]
      cmderr	[resource-manager] node-pre-gyp
      cmderr	[resource-manager] WARN Using request for node-pre-gyp https download
      cmderr	[resource-manager] WARN template-schema-validation-tools@1.0.0 No repository field.
      cmderr	[resource-manager] optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
      cmderr	[resource-manager] npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
    ️⚠️ azure-sdk-for-java warning [Detail]
    • ⚠️Warning [Logs]Release - Generate from bac7543. SDK Automation 14.0.0
      command	./eng/mgmt/automation/init.sh ../azure-sdk-for-java_tmp/initInput.json ../azure-sdk-for-java_tmp/initOutput.json
      command	./eng/mgmt/automation/generate.py ../azure-sdk-for-java_tmp/generateInput.json ../azure-sdk-for-java_tmp/generateOutput.json
      cmderr	[generate.py] 2021-01-08 17:40:23 INFO [VERSION][Not Found] cannot find version for "com.azure.resourcemanager:azure-resourcemanager-kubernetesconfiguration"
      cmderr	[generate.py] 2021-01-08 17:40:23 INFO [VERSION][Not Found] cannot find stable version, current version "1.0.0-beta.1"
      cmderr	[generate.py] 2021-01-08 17:40:23 INFO autorest --version=3.0.6350 --use=@autorest/java@4.0.8 --java.azure-libraries-for-java-folder=/home/vsts/work/1/s/azure-sdk-for-java --java.output-folder=/home/vsts/work/1/s/azure-sdk-for-java/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration --java.namespace=com.azure.resourcemanager.kubernetesconfiguration  --package-version=1.0.0-beta.1 --java --pipeline.modelerfour.additional-checks=false --pipeline.modelerfour.lenient-model-deduplication=true --azure-arm --verbose --sdk-integration --fluent=lite --java.fluent=lite --java.license-header=MICROSOFT_MIT_SMALL ../azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md
      cmderr	[generate.py] 2021-01-08 17:41:01 INFO [CI][Success] Write to ci.yml
      cmderr	[generate.py] 2021-01-08 17:41:01 INFO [POM][Process] dealing with pom.xml
      cmderr	[generate.py] 2021-01-08 17:41:01 INFO [POM][Success] Write to pom.xml
      cmderr	[generate.py] 2021-01-08 17:41:01 INFO [POM][Process] dealing with root pom
      cmderr	[generate.py] 2021-01-08 17:41:01 ERROR [POM][Skip] find more than one <modules> in pom
      cmderr	[generate.py] 2021-01-08 17:41:09 ERROR [GENERATE] Maven build fail
    • ️✔️azure-resourcemanager-kubernetesconfiguration [View full logs]  [Release SDK Changes]
      cmderr	[Inst] 2021-01-08 17:41:48 DEBUG Got artifact_id: azure-resourcemanager-kubernetesconfiguration
      cmderr	[Inst] 2021-01-08 17:41:48 DEBUG Got artifact: pom.xml
      cmderr	[Inst] 2021-01-08 17:41:48 ERROR Unmatch any jar in artifacts
    ️️✔️ azure-sdk-for-python succeeded [Detail] [Expand]
    • ️✔️Succeeded [Logs]Release - Generate from bac7543. SDK Automation 14.0.0
      warn	Skip initScript due to not configured
      command	npx n 12
      command	python3 -m venv venv
      command	pip install --upgrade setuptools wheel pip
      command	pip install pathlib jinja2 msrestazure
      command	autorest --version=V2 --use=@microsoft.azure/autorest.python@~4.0.71 --python --python-mode=update --multiapi --keep-version-file --no-async --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk ../azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md
    • ️✔️azure-mgmt-kubernetesconfiguration [View full logs]  [Release SDK Changes] Breaking Change Detected
      cmderr	[buildConf] INFO:packaging_tools:Building template azure-mgmt-kubernetesconfiguration
      cmderr	[buildConf] INFO:packaging_tools.conf:Skipping default conf since the file exists
      cmderr	[buildConf] INFO:packaging_tools:Skipping CHANGELOG.md template, since a previous one was found
      cmderr	[buildConf] INFO:packaging_tools:Template done azure-mgmt-kubernetesconfiguration
      cmderr	[changelogSetup] WARNING: Skipping azure-nspkg as it is not installed.
      cmderr	[changelogReport] INFO:__main__:Looking for Autorest generated package in azure.mgmt.kubernetesconfiguration
      cmderr	[changelogReport] INFO:__main__:Found azure.mgmt.kubernetesconfiguration
      cmderr	[changelogReport] INFO:__main__:Working on azure.mgmt.kubernetesconfiguration
      cmderr	[changelogReport] INFO:__main__:Report written to sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/code_reports/latest/report.json
      cmderr	[changelogReportLatest] INFO:__main__:Download versions of azure-mgmt-kubernetesconfiguration on PyPI
      cmderr	[changelogReportLatest] INFO:__main__:Got ['0.1.0', '0.2.0', '1.0.0b1']
      cmderr	[changelogReportLatest] INFO:__main__:Only keep last PyPI version
      cmderr	[changelogReportLatest] INFO:__main__:Installing version 0.2.0 of azure-mgmt-kubernetesconfiguration in a venv
      cmderr	[changelogReportLatest] Cache entry deserialization failed, entry ignored
      cmderr	[changelogReportLatest] INFO:__main__:Looking for Autorest generated package in azure.mgmt.kubernetesconfiguration
      cmderr	[changelogReportLatest] INFO:__main__:Found azure.mgmt.kubernetesconfiguration
      cmderr	[changelogReportLatest] INFO:__main__:Working on azure.mgmt.kubernetesconfiguration
      cmderr	[changelogReportLatest] INFO:__main__:Report written to sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/code_reports/0.2.0/report.json
      cmdout	[Changelog] Size of delta 29.230% size of original (original: 9172 chars, delta: 2681 chars)
      cmdout	[Changelog] **Features**
      cmdout	[Changelog]   - Model ProxyResource has a new parameter system_data
      cmdout	[Changelog]   - Model SourceControlConfiguration has a new parameter system_data
      cmdout	[Changelog]   - Model SourceControlConfiguration has a new parameter configuration_protected_settings
      cmdout	[Changelog]   - Model SourceControlConfiguration has a new parameter ssh_known_hosts_contents
      cmdout	[Changelog]   - Model ResourceProviderOperation has a new parameter is_data_action
      cmdout	[Changelog]   - Model Resource has a new parameter system_data
      cmdout	[Changelog] **Breaking changes**
      cmdout	[Changelog]   - Model ErrorDefinition has a new signature
      warn	Breaking change found in changelog
    ️️✔️ azure-sdk-for-go succeeded [Detail] [Expand]
    • ️✔️Succeeded [Logs]Release - Generate from bac7543. SDK Automation 14.0.0
      command	sh ./initScript.sh ../../../../../azure-sdk-for-go_tmp/initInput.json ../../../../../azure-sdk-for-go_tmp/initOutput.json
      command	go run ./tools/generator/main.go ../../../../../azure-sdk-for-go_tmp/generateInput.json ../../../../../azure-sdk-for-go_tmp/generateOutput.json
    • ️✔️preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration [View full logs]  [Release SDK Changes]
      info	[Changelog] No exported changes
    ️️✔️[Staging] ApiDocPreview succeeded [Detail] [Expand]
     Please click here to preview with your @microsoft account. 
    Posted by Swagger Pipeline | How to fix these errors?

    @openapi-workflow-bot
    Copy link

    Hi @iscai-msft, one or multiple breaking change(s) is detected in your PR. Please check out the breaking change(s), and provide business justification in the PR comment and @ PR assignee why you must have these change(s), and how external customer impact can be mitigated. Please ensure to follow breaking change policy to request breaking change review and approval before proceeding swagger PR review.
    Action: To initiate an evaluation of the breaking change, create a new intake using the template for breaking changes. Addition details on the process and office hours are on the Breaking change Wiki.
    If you think it is false positive breaking change, please provide the reasons in the PR comment, report to Swagger Tooling Team via https://aka.ma/swaggerfeedback.

    Copy link
    Contributor

    @leni-msft leni-msft left a comment

    Choose a reason for hiding this comment

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

    @iscai-msft We do have a LintRule R3018 EnumInsteadOfBoolean to encourage defining boolean as enum.

    @iscai-msft
    Copy link
    Contributor Author

    interesting @leni-msft, wasn't aware of that. However, the rule does state that you should only make it an enum if there will be more than 2 values possible. Since this is just true or false, we should stick to type: boolean.

    the intent is to consider if there could be more than 2 values possible for the property in the future or not. If the answer is no, then a boolean is fine
    

    @jsntcy
    Copy link
    Member

    jsntcy commented Jan 6, 2021

    @NarayanThiru, please help review the changes for Kubernetesconfiguration.
    @roytan-microsoft, please help review the changes for MixedReality.

    @NarayanThiru
    Copy link
    Member

    Hey @iscai-msft, why this change must be made now? I don't understand what tool/process is breaking/broken and why it cannot handle enums - can you explain?

    Since this is a breaking change, do I own the breaking change process to get this approved? We have our GA release in <2 months and are focused on that - so I cannot take up any additional work. Actually, can this wait for a few weeks? Asking, since I will be creating a new api-version for GA - end of Jan/early Feb, and can include this change as part of that.

    @roytan-microsoft
    Copy link
    Contributor

    @iscai-msft I have already made changes to those files in these commits:

    19bb280
    4844fe0

    @iscai-msft
    Copy link
    Contributor Author

    @NarayanThiru boolean enums do not work in python as a language, so Python code is broken here. It might also cause issues in other languages.

    @roytan-microsoft it looks lke your PRs don't contain fixes for EnableHelmOperatorDefinition in 2020-10-01 in kubernetes. Do you mind if I just go ahead with merging this PR since it's targeted to removing all bool enums?

    @roytan-microsoft
    Copy link
    Contributor

    @iscai-msft EnableHelmOperatorDefinition is not under the MixedReality namespace. For the mixedreality change, it should be a noop for us, so I'm ok with that.

    @iscai-msft
    Copy link
    Contributor Author

    iscai-msft commented Jan 8, 2021

    @roytan-microsoft i'll remove the mixed reality code from this pr as you'll merge the code yourself. My apologies, I thought you also worked in the kubernetes namespace. thanks!
    Just want to reiterate that pythonn ca'nt handle boolean enums, so the python sdk you generate will be broken until you check in the changes to the boolean enums

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    7 participants