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

fix: go enum schema changes #189

Merged
merged 10 commits into from
Jul 15, 2022
Merged

fix: go enum schema changes #189

merged 10 commits into from
Jul 15, 2022

Conversation

kridai
Copy link
Contributor

@kridai kridai commented Jul 14, 2022

Fixes

Added support to parse enum changes added in OAI spec for go as part of the PR: twilio/twilio-oai#71

updated to spec file for related enum changes

Checklist

  • I acknowledge that all my contributions will be made under the project's license
  • Run make test-docker
  • Verify affected language:
    • Generate twilio-go from our OpenAPI specification using the build_twilio_go.py using python examples/build_twilio_go.py path/to/twilio-oai/spec/yaml path/to/twilio-go and inspect the diff
    • Run make test in twilio-go
    • Create a pull request in twilio-go
    • Provide a link below to the pull request
  • I have made a material change to the repo (functionality, testing, spelling, grammar)
  • I have read the Contribution Guidelines and my PR follows them
  • I have titled the PR appropriately
  • I have updated my branch with the main branch
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation about the functionality in the appropriate .md file
  • I have added inline documentation to the code I modified

If you have questions, please create a GitHub Issue in this repository.

private Map<String, ModelsMap> filterOutEnumResults( Map<String, ModelsMap> results) {
HashMap <String, ModelsMap> resultMap = new HashMap<>();
results.forEach((key ,value) -> {
if (!key.contains("_enum_")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a ticket in the backlog to revisit this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nope, We will create it tomorrow and we will also create other improvement tickets for preview and alternative approach to enum name in OAI schema models

String[] value = property.dataType.split("Enum");
property.datatypeWithEnum = value[value.length-1];
property.dataType = "string";
property.isEnum = property.dataType == null;;
Copy link
Contributor

Choose a reason for hiding this comment

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

This would always be false.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, This should be property.isEnum = property.dataFormat == null;; Will fix it before merging

@sonarcloud
Copy link

sonarcloud bot commented Jul 15, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

62.1% 62.1% Coverage
37.2% 37.2% Duplication

@charan678 charan678 merged commit 4b807ac into main Jul 15, 2022
@charan678 charan678 deleted the go_enum_schema_changes branch July 15, 2022 15:53
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.

3 participants