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

[Backport 2.x] Backport codegen implementation #1173

Merged
merged 16 commits into from
Aug 30, 2024

Commits on Aug 30, 2024

  1. Generate client code from OpenAPI specification (opensearch-project#366)

    * OpenAPI generator from scratch
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Write to files and generate object shapes
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Output response shapes and enum shapes
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Fix builder setters for enums
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Better handling of required fields
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Unify templates for ObjectShape/OperationRequest
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Simple http path expression
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Generate client class
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Cleanup
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Generate namespaces remote store client
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Add license header, improve http path builder, fix remote store spec
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Suppress checkstyle unused imports lint for generated code
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Centralize some naming
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Allow renaming operations
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Add generated warning header
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Refactor
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Less code more templates
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Simplify http path part
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Fixes
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Swap to swagger-parser
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Handle x-data-type & array response bodies
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Handle multiple http paths for same operation
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Improve type handling
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Tweak package name determination
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Handle additionalProperties on ErrorCause
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Simplify enum shape
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Change default number type
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Generate parameter-less operation method when no required fields
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Refactor to parse multi-file spec
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * spotlessApply
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Use spotless to format code
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Maintain spec location information
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Refactor model transformation and type mapper
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Match existing naming scheme
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Change OperationGroup matching logic to determine which to generate
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Better handle errors thrown by formatter
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Add typedef comment
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Support tagged union
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Add additional reserved keywords
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Improve parsing logic
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Add basic tests and implement proper argument parsing
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Improve tagged union generation and filter global query params
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Change enum naming style
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Handle Time type
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Handle deprecation
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Clear operations to generate
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Change usages of `<stream>.toList()` to `<stream>.collect(Collectors.toList())`
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Remove publishing from build.gradle
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Cleaning up
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * spotless
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    ---------
    
    Signed-off-by: Thomas Farr <[email protected]>
    (cherry picked from commit bb995ec)
    Xtansia committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    46911cc View commit details
    Browse the repository at this point in the history
  2. Bump commons-codec:commons-codec from 1.11.0 to 1.17.0 in java-codegen (

    opensearch-project#1023)
    
    Signed-off-by: Thomas Farr <[email protected]>
    (cherry picked from commit 13982b1)
    Xtansia committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    80b2e29 View commit details
    Browse the repository at this point in the history
  3. Regenerate request/response for the info operation (opensearch-proj…

    …ect#1026)
    
    * Tweak formatting rules used by codegen to allow reformatting javadoc
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Support codegen for request shapes that may be singleton
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Generate info operation shapes
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    ---------
    
    Signed-off-by: Thomas Farr <[email protected]>
    (cherry picked from commit dea7e72)
    Xtansia committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    499efde View commit details
    Browse the repository at this point in the history
  4. Enforce & fix license headers (opensearch-project#1027)

    * Enforce license headers
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * spotlessApply
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    ---------
    
    Signed-off-by: Thomas Farr <[email protected]>
    (cherry picked from commit 5d5c6b5)
    Xtansia committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    0a5372b View commit details
    Browse the repository at this point in the history
  5. Add @Generated annotation to generated classes (opensearch-project#…

    …1029)
    
    Signed-off-by: Thomas Farr <[email protected]>
    (cherry picked from commit 767c313)
    Xtansia committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    3111457 View commit details
    Browse the repository at this point in the history
  6. Begin generating client implementations (opensearch-project#1052)

    * Tweak client generation to extend from existing classes
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Modify existing client classes to be abstract base classes
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Re-run generator
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * ./gradlew spotlessApply
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    ---------
    
    Signed-off-by: Thomas Farr <[email protected]>
    (cherry picked from commit dbde609)
    Xtansia committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    7f0adb6 View commit details
    Browse the repository at this point in the history
  7. Bump org.junit:junit-bom from 5.10.2 to 5.10.3 (opensearch-project#1062)

    * Bump org.junit:junit-bom from 5.10.2 to 5.10.3
    
    Bumps [org.junit:junit-bom](https://github.com/junit-team/junit5) from 5.10.2 to 5.10.3.
    - [Release notes](https://github.com/junit-team/junit5/releases)
    - [Commits](junit-team/junit5@r5.10.2...r5.10.3)
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    ---
    updated-dependencies:
    - dependency-name: org.junit:junit-bom
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    
    * Update changelog
    
    Signed-off-by: dependabot[bot] <[email protected]>
    
    ---------
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
    (cherry picked from commit af769c8)
    dependabot[bot] authored and Xtansia committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    4e9c232 View commit details
    Browse the repository at this point in the history
  8. Bump org.owasp.dependencycheck from 9.2.0 to 10.0.2 (opensearch-proje…

    …ct#1069)
    
    * Bump org.owasp.dependencycheck from 9.2.0 to 10.0.2
    
    Bumps org.owasp.dependencycheck from 9.2.0 to 10.0.2.
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    ---
    updated-dependencies:
    - dependency-name: org.owasp.dependencycheck
      dependency-type: direct:production
      update-type: version-update:semver-major
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    
    * Update changelog
    
    Signed-off-by: dependabot[bot] <[email protected]>
    
    ---------
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
    (cherry picked from commit 848be31)
    dependabot[bot] authored and Xtansia committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    361c902 View commit details
    Browse the repository at this point in the history
  9. Add workflow to auto-update codegen (opensearch-project#1065)

    Signed-off-by: Thomas Farr <[email protected]>
    (cherry picked from commit 0cf11db)
    Xtansia committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    9ae2746 View commit details
    Browse the repository at this point in the history
  10. Fix handling of OpenAPI schemas with multiple types (opensearch-proje…

    …ct#1102)
    
    Signed-off-by: Thomas Farr <[email protected]>
    (cherry picked from commit eff1ae1)
    Xtansia committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    106233a View commit details
    Browse the repository at this point in the history
  11. Regenerate dangling_indices namespace (opensearch-project#1124)

    * Rename genericArgs to typeParams
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Fix required path param handling
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Correctly generate AcknowledgedResponseBase
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Generate DeleteDanglingIndexRequest
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Correctly generate DeleteDanglingIndexResponse
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Generate import_dangling_index
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Generate ListDanglingIndicesRequest
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Generate ErrorCause
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Generate NodeStatistics
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Generate DanglingIndex
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Generate ListDanglingIndicesResponse
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Generate DanglingIndicesClient
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Fixes
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Changelog and Upgrading
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Fix javadoc
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Fix tests
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    ---------
    
    Signed-off-by: Thomas Farr <[email protected]>
    (cherry picked from commit 324f90a)
    Xtansia committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    52f245b View commit details
    Browse the repository at this point in the history
  12. Bump com.github.jk1.dependency-license-report from 2.8 to 2.9 (opense…

    …arch-project#1144)
    
    Bumps com.github.jk1.dependency-license-report from 2.8 to 2.9.
    
    Signed-off-by: Thomas Farr <[email protected]>
    ---
    updated-dependencies:
    - dependency-name: com.github.jk1.dependency-license-report
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    (cherry picked from commit 08e7e65)
    dependabot[bot] authored and Xtansia committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    f37f1c2 View commit details
    Browse the repository at this point in the history
  13. Tweak codegen logic for formatting, documentation and handling of any…

    …Of (opensearch-project#1152)
    
    * Re-generate code
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Improve builder doc comments
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Fix list/map isDefined serialize logic
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Add support for deprecated enums
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Improve isDefined logic
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Allow overriding request/response naming
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Support anyOf
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Update spec
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * spotlessApply
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    ---------
    
    Signed-off-by: Thomas Farr <[email protected]>
    (cherry picked from commit 7b954af)
    Xtansia committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    cd49cec View commit details
    Browse the repository at this point in the history
  14. Generate the ml namespace (opensearch-project#1158)

    * Generate ml.register_model_group
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Start neural search sample
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Re-generate ShardStatistics
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Re-generate ShardFailure
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Re-generate Result
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Re-generate WriteResponseBase
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Generate ml.delete_model_group
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Generate ml.register_model
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Exclude legacy license from ml namespace
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Generate ml.get_task
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Generate ml.delete_task
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Generate ml.delete_model
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Generate ml.deploy_model
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Generate ml.undeploy_model
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Complete neural search sample
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Generate ml.get_model
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Add changelog entry
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * note
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Fix tests
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    ---------
    
    Signed-off-by: Thomas Farr <[email protected]>
    (cherry picked from commit c6e61e1)
    Xtansia committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    ef61281 View commit details
    Browse the repository at this point in the history
  15. Invert abstractness of generated vs "handwritten" client classes (ope…

    …nsearch-project#1170)
    
    * Invert abstractness of generated vs "handwritten" client classes
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    * Address review comments
    
    Signed-off-by: Thomas Farr <[email protected]>
    
    ---------
    
    Signed-off-by: Thomas Farr <[email protected]>
    (cherry picked from commit 42e2928)
    Xtansia committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    4ccbab3 View commit details
    Browse the repository at this point in the history
  16. Temporarily disable code gen up-to-date check

    Signed-off-by: Thomas Farr <[email protected]>
    Xtansia committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    3bc3ebf View commit details
    Browse the repository at this point in the history