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

build(api-client): generate java, go clients #393

Closed
petermetz opened this issue Nov 20, 2020 · 10 comments · Fixed by #3314
Closed

build(api-client): generate java, go clients #393

petermetz opened this issue Nov 20, 2020 · 10 comments · Fixed by #3314
Assignees
Labels
dependencies Pull requests that update a dependency file Developer_Experience enhancement New feature or request good-first-issue Good for newcomers Hacktoberfest Hacktoberfest participants are welcome to take a stab at issues marked with this label. Nice-to-Have P1 Priority 1: Highest
Milestone

Comments

@petermetz
Copy link
Contributor

Description

As a developer I want to not be forced to use the NodeJS/Javascript API client if my primary programming language is something else so that I can achieve high productivity through Cactus no matter the language I'm using.

  • This is different from a similar looking issue which discusses the possibility of writing plugins in different languages as well.
  • We do not need write much Go/Java code because 99% of it is auto-generated. See the Acceptance criteria 4)

Here is a complete list of programming languages that are supported by the OpenAPI generator (which we can take full advantage of since we are using the OpenAPI specs)
https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages

Acceptance Criteria

  1. Clients for Java and Go are generated as part of the full build
  2. Dev builds only build the Typescript API client to remain as fast as possible
  3. Publishing of the Java and Go API clients is included in the release process => if I run the release scripts the full build runs and the Java, Go clients are published/made available for public consumption the same way we do with the Typescript API client (it gets published to npm)
  4. Client side routing is supported by the Go/Java API clients as well.

cc: @takeutak @sfuji822 @jonathan-m-hamilton

@petermetz petermetz added enhancement New feature or request good-first-issue Good for newcomers dependencies Pull requests that update a dependency file Developer_Experience Hacktoberfest Hacktoberfest participants are welcome to take a stab at issues marked with this label. labels Nov 20, 2020
@petermetz petermetz added this to the v0.4.0 milestone Nov 20, 2020
@petermetz petermetz modified the milestones: v0.4.0, v0.7.0, v1.0.0 Feb 9, 2021
@petermetz
Copy link
Contributor Author

This blew up in complexity because the oneOf allOf keywords are not universally supported among the different OpenAPI generators the way they are for the typescript-axios generator so it's not immediately obvious how to migrate away from these unsupported keywords. The other option is to wait for them to add support (or help them implement it) so that we can just go back to a much lower complexity in the scope of this issue once those generators "just work" out of the box.

@petermetz petermetz added the P1 Priority 1: Highest label Aug 20, 2023
@petermetz petermetz self-assigned this Aug 20, 2023
@petermetz petermetz modified the milestones: v1.0.0, v2.0.0-rc.2 Aug 20, 2023
@petermetz petermetz removed their assignment Aug 23, 2023
@jagpreetsinghsasan jagpreetsinghsasan self-assigned this Sep 11, 2023
@jagpreetsinghsasan jagpreetsinghsasan moved this from Todo to In Progress in Cacti_Scrum_Project_v2_Release Sep 20, 2023
@jagpreetsinghsasan
Copy link
Contributor

For the Go artifacts, publishing the api-client code (as a commit to cacti github code) itself will act as the artifact, right?
Then we can import it something like
import cactus-cmd-api-server "github.com/hyperledger/cacti/packages/cactus-cmd-api-server/src/main/go/generated/openapi/go-client"
@petermetz is this fine?

@jagpreetsinghsasan
Copy link
Contributor

The kotlin jar generation is broken, mostly due to openapi-generator upgrade, will fix those alongwith this issue.

@petermetz
Copy link
Contributor Author

For the Go artifacts, publishing the api-client code (as a commit to cacti github code) itself will act as the artifact, right? Then we can import it something like import cactus-cmd-api-server "github.com/hyperledger/cacti/packages/cactus-cmd-api-server/src/main/go/generated/openapi/go-client" @petermetz is this fine?

@jagpreetsinghsasan Yes, works fine for me. Please open a follow-up issue there to mimic how it is being done for the weaver components (@sandeepnRES wrote some scripts or GH actions to do tag based releases IIRC)

@jagpreetsinghsasan jagpreetsinghsasan moved this from In Progress to Blocked in Cacti_Scrum_Project_v2_Release Oct 11, 2023
@jagpreetsinghsasan jagpreetsinghsasan moved this from Blocked to In Progress in Cacti_Scrum_Project_v2_Release Dec 18, 2023
@jagpreetsinghsasan
Copy link
Contributor

One of the issues I faced during generating java artifacts was that in cactus-core-api openapi specs, we have a field within JWSRecipient termed protected which matches with the Java protected keyword, thus the generated code cannot produce the respective client JAR
(I will create an issue to address the same, mentioning it for future reference)

@jagpreetsinghsasan
Copy link
Contributor

Openapi specs
image

Generated code (throwing errors)
image

@jagpreetsinghsasan
Copy link
Contributor

jagpreetsinghsasan commented Jan 4, 2024

JAR parsing for cactus-plugin-htlc-eth-besu, cactuls-plugin-htlc-eth-besu-erc20, connector-besu, connector-ethereum, connector-quorum, connector-xdai fails due to invalid Java code being generated
image

Other devs are also facing the same issue: OpenAPITools/openapi-generator#12556 (comment)

@jagpreetsinghsasan
Copy link
Contributor

jagpreetsinghsasan commented Jan 4, 2024

connector-iroha , connector-iroha2 faces yet another bug related to openapi codegen (<, > signs arent rendered correctly)
OpenAPITools/openapi-generator#11601

image

jagpreetsinghsasan added a commit to jagpreetsinghsasan/cactus that referenced this issue Jan 5, 2024
    Primary Changes
    ---------------
    1. Updated package.json of packages to include the new
       codegen scripts
    2. Added a new workflow to create and upload the jars from
       the newly added code

   Changes required to incorporate 1)
   ---------------------------------
   3. Added replace package to assist the codegen scripts
      written in package.json

Fixes hyperledger-cacti#393

Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
jagpreetsinghsasan added a commit to jagpreetsinghsasan/cactus that referenced this issue Jan 11, 2024
    Primary Changes
    ---------------
    1. Updated package.json of packages to include the new
       codegen scripts
    2. Added a new workflow to create and upload the jars from
       the newly added code

   Changes required to incorporate 1)
   ---------------------------------
   3. Added replace package to assist the codegen scripts
      written in package.json

Fixes hyperledger-cacti#393

Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
sandeepnRES pushed a commit to jagpreetsinghsasan/cactus that referenced this issue Jan 18, 2024
    Primary Changes
    ---------------
    1. Updated package.json of packages to include the new
       codegen scripts
    2. Added a new workflow to create and upload the jars from
       the newly added code

   Changes required to incorporate 1)
   ---------------------------------
   3. Added replace package to assist the codegen scripts
      written in package.json

Fixes hyperledger-cacti#393

Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
petermetz pushed a commit to jagpreetsinghsasan/cactus that referenced this issue Jan 19, 2024
    Primary Changes
    ---------------
    1. Updated package.json of packages to include the new
       codegen scripts
    2. Added a new workflow to create and upload the jars from
       the newly added code

   Changes required to incorporate 1)
   ---------------------------------
   3. Added replace package to assist the codegen scripts
      written in package.json

Fixes hyperledger-cacti#393

Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
@jagpreetsinghsasan jagpreetsinghsasan moved this from In Progress to In review in Cacti_Scrum_Project_v2_Release Feb 1, 2024
jagpreetsinghsasan added a commit to jagpreetsinghsasan/cactus that referenced this issue Jun 12, 2024
    Primary Changes
    ----------------
    1. Updated package.json file for packages to
       include the new codegen script
    2. Added a new dep, replace for string
       manupulation in package.json

Fixes hyperledger-cacti#393

Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
jagpreetsinghsasan added a commit to jagpreetsinghsasan/cactus that referenced this issue Jun 12, 2024
    Primary Changes
    ----------------
    1. Updated package.json file for packages to
       include the new codegen script
    2. Added a new dep, replace for string
       manupulation in package.json

Fixes hyperledger-cacti#393

Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
jagpreetsinghsasan added a commit to jagpreetsinghsasan/cactus that referenced this issue Jun 12, 2024
    Primary Changes
    ----------------
    1. Updated package.json file for packages to
       include the new codegen script
    2. Added a new dep, replace for string
       manupulation in package.json

Fixes hyperledger-cacti#393

Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
@jagpreetsinghsasan
Copy link
Contributor

jagpreetsinghsasan commented Jun 12, 2024

As per the conversation here, dropping the java clients from the issue (as the same is already achieved using Kotlin)

@petermetz
Copy link
Contributor Author

As per the conversation here, dropping the java clients from the issue (as the same is already achieved using Kotlin)

@jagpreetsinghsasan Thank you!

jagpreetsinghsasan added a commit to jagpreetsinghsasan/cactus that referenced this issue Jun 27, 2024
    Primary Changes
    ----------------
    1. Updated package.json file for packages to
       include the new codegen script
    2. Added a new dep, replace for string
       manupulation in package.json

Fixes hyperledger-cacti#393

Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
jagpreetsinghsasan added a commit to jagpreetsinghsasan/cactus that referenced this issue Jun 27, 2024
    Primary Changes
    ----------------
    1. Updated package.json file for packages to
       include the new codegen script
    2. Added a new dep, replace for string
       manupulation in package.json

Fixes hyperledger-cacti#393

Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
jagpreetsinghsasan added a commit to jagpreetsinghsasan/cactus that referenced this issue Jun 27, 2024
    Primary Changes
    ----------------
    1. Updated package.json file for packages to
       include the new codegen script
    2. Added a new dep, replace for string
       manupulation in package.json

Fixes hyperledger-cacti#393
Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
@petermetz petermetz modified the milestones: v2.0.0-rc.2, v2.0.0-rc.3 Jul 5, 2024
jagpreetsinghsasan added a commit to jagpreetsinghsasan/cactus that referenced this issue Jul 13, 2024
    Primary Changes
    ----------------
    1. Updated package.json file for packages to
       include the new codegen script
    2. Added a new dep, replace for string
       manupulation in package.json

Fixes hyperledger-cacti#393
Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
jagpreetsinghsasan added a commit to jagpreetsinghsasan/cactus that referenced this issue Jul 13, 2024
    Primary Changes
    ----------------
    1. Updated package.json file for packages to
       include the new codegen script
    2. Added a new dep, replace for string
       manupulation in package.json

Fixes hyperledger-cacti#393
Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
petermetz pushed a commit to jagpreetsinghsasan/cactus that referenced this issue Jul 18, 2024
    Primary Changes
    ----------------
    1. Updated package.json file for packages to
       include the new codegen script
    2. Added a new dep, replace for string
       manupulation in package.json

Fixes hyperledger-cacti#393
Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
jagpreetsinghsasan added a commit to jagpreetsinghsasan/cactus that referenced this issue Jul 20, 2024
    Primary Changes
    ----------------
    1. Updated package.json file for packages to
       include the new codegen script
    2. Added a new dep, replace for string
       manupulation in package.json

Fixes hyperledger-cacti#393

Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
jagpreetsinghsasan added a commit to jagpreetsinghsasan/cactus that referenced this issue Jul 22, 2024
    Primary Changes
    ----------------
    1. Updated package.json file for packages to
       include the new codegen script
    2. Added a new dep, replace for string
       manupulation in package.json

Fixes hyperledger-cacti#393

Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
jagpreetsinghsasan added a commit to jagpreetsinghsasan/cactus that referenced this issue Jul 22, 2024
    Primary Changes
    ----------------
    1. Updated package.json file for packages to
       include the new codegen script
    2. Added a new dep, replace for string
       manupulation in package.json

Fixes hyperledger-cacti#393

Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
jagpreetsinghsasan added a commit to jagpreetsinghsasan/cactus that referenced this issue Jul 25, 2024
    Primary Changes
    ----------------
    1. Updated package.json file for packages to
       include the new codegen script
    2. Added a new dep, replace for string
       manupulation in package.json

Fixes hyperledger-cacti#393

Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
jagpreetsinghsasan added a commit to jagpreetsinghsasan/cactus that referenced this issue Jul 25, 2024
    Primary Changes
    ----------------
    1. Updated package.json file for packages to
       include the new codegen script
    2. Added a new dep, replace for string
       manupulation in package.json

Fixes hyperledger-cacti#393

Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
petermetz pushed a commit to jagpreetsinghsasan/cactus that referenced this issue Jul 25, 2024
    Primary Changes
    ----------------
    1. Updated package.json file for packages to
       include the new codegen script
    2. Added a new dep, replace for string
       manupulation in package.json

Fixes hyperledger-cacti#393

Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
@github-project-automation github-project-automation bot moved this from In review to Done in Cacti_Scrum_Project_v2_Release Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file Developer_Experience enhancement New feature or request good-first-issue Good for newcomers Hacktoberfest Hacktoberfest participants are welcome to take a stab at issues marked with this label. Nice-to-Have P1 Priority 1: Highest
Projects
None yet
2 participants