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 go client #3314

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

jagpreetsinghsasan
Copy link
Contributor

@jagpreetsinghsasan jagpreetsinghsasan commented Jun 12, 2024

Commit to be reviewed

build(api-client): generate go client

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 #393

Pull Request Requirements

  • Rebased onto upstream/main branch and squashed into single commit to help maintainers review it more efficient and to avoid spaghetti git commit graphs that obfuscate which commit did exactly what change, when and, why.
  • Have git sign off at the end of commit message to avoid being marked red. You can add -s flag when using git commit command. You may refer to this link for more information.
  • Follow the Commit Linting specification. You may refer to this link for more information.

Character Limit

  • Pull Request Title and Commit Subject must not exceed 72 characters (including spaces and special characters).
  • Commit Message per line must not exceed 80 characters (including spaces and special characters).

A Must Read for Beginners
For rebasing and squashing, here's a must read guide for beginners.

Copy link
Contributor

@petermetz petermetz left a comment

Choose a reason for hiding this comment

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

@jagpreetsinghsasan LGTM, but please wait with merging this until after the openapi spec refaactor that's pending review right now. I don't think this PR should get deeply affected, but just to be on the safe side.

One more thing: The diff is insanely large so I can't review line by line. Could you please confirm that the only additions are the codegen scripts in the package.json files and the generated sources? E.g., there is no other thing in the diff to review that was manually written code?

@jagpreetsinghsasan
Copy link
Contributor Author

jagpreetsinghsasan commented Jun 13, 2024

@jagpreetsinghsasan LGTM, but please wait with merging this until after the openapi spec refaactor that's pending review right now. I don't think this PR should get deeply affected, but just to be on the safe side.

One more thing: The diff is insanely large so I can't review line by line. Could you please confirm that the only additions are the codegen scripts in the package.json files and the generated sources? E.g., there is no other thing in the diff to review that was manually written code?

@petermetz apart from the generated code, these changes were also done

  1. Added replace@1.2.2 library in root package.json (needed to do string manupulation in the per-package package.json files) and thus the changes to yarn.lock (Example: openapi-generator-cli generate -i ./src/main/json/openapi.json -g go -o ./src/main/go/generated/openapi/go-client/ --git-user-id hyperledger --git-repo-id $(echo $npm_package_name | replace @hyperledger/ \"\" -z)/src/main/go/generated/openapi/go-client --package-name $(echo $npm_package_name | replace @hyperledger/ \"\" -z) --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore)
  2. Updated the openapi-generator-ignore file to include **/generated/openapi/go-client/docs/** so that the go docs arent generated by default

@petermetz
Copy link
Contributor

@jagpreetsinghsasan LGTM, but please wait with merging this until after the openapi spec refaactor that's pending review right now. I don't think this PR should get deeply affected, but just to be on the safe side.
One more thing: The diff is insanely large so I can't review line by line. Could you please confirm that the only additions are the codegen scripts in the package.json files and the generated sources? E.g., there is no other thing in the diff to review that was manually written code?

@petermetz apart from the generated code, these changes were also done

1. Added `replace@1.2.2` library in root package.json (needed to do string manupulation in the per-package package.json files) and thus the changes to yarn.lock (Example: `openapi-generator-cli generate -i ./src/main/json/openapi.json -g go -o ./src/main/go/generated/openapi/go-client/ --git-user-id hyperledger --git-repo-id $(echo $npm_package_name | replace @hyperledger/ \"\" -z)/src/main/go/generated/openapi/go-client --package-name $(echo $npm_package_name | replace @hyperledger/ \"\" -z)  --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore`)

2. Updated the `openapi-generator-ignore` file to include `**/generated/openapi/go-client/docs/**` so that the go docs arent generated by default

@jagpreetsinghsasan Got it, thank you for confirming! LGTM (still)

Copy link
Contributor

@outSH outSH left a comment

Choose a reason for hiding this comment

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

LGTM but please fix the CI

Copy link
Contributor

@petermetz petermetz left a comment

Choose a reason for hiding this comment

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

Plus one for fixing the CI :-)

@jagpreetsinghsasan jagpreetsinghsasan force-pushed the feature-393b branch 3 times, most recently from a089264 to 5f00f4f Compare June 27, 2024 08:05
@jagpreetsinghsasan
Copy link
Contributor Author

I just had a look at the CI, did some changes, looks like some issue with either the codegen script or the ci script. Looking into the same. Will re-request for review once fixed.

Also facing DCI Lint issues because the generated go code has incode comments refering to master keyword (a git url with master branch)

@jagpreetsinghsasan
Copy link
Contributor Author

Hi @petermetz
The yarn codegen seems to show that these 2 files are generated (and aren't pushed), thus the codegen test failing
image

But when I run the codegen locally, I dont see those 2 extra files getting created
image

What could be the possible scenario for such a failure (now that we clean the codegen folders as a part of codegen warmup script, such discrepancies shouldn't even exist)?
I even tried deleting just those 2 files and ran codegen again, but still the diff on local machine was zero

@petermetz
Copy link
Contributor

Hi @petermetz The yarn codegen seems to show that these 2 files are generated (and aren't pushed), thus the codegen test failing image

But when I run the codegen locally, I dont see those 2 extra files getting created image

What could be the possible scenario for such a failure (now that we clean the codegen folders as a part of codegen warmup script, such discrepancies shouldn't even exist)? I even tried deleting just those 2 files and ran codegen again, but still the diff on local machine was zero

@jagpreetsinghsasan I'm not sure either TBH, but there's definitely race conditions in codegen because when I try to run it locally it crashes with the logs pasted below. So, I'd say let's fix the race condition first so that it reliably runs on my machine too and then we can establish an additional data point after that (whether it works on my machine or fails like it does on the CI with those 2 extra files ending up in the diff somehow). Once I'm able to reproduce the issue one way or another then I can try and investigate it more closely.

For the race condition itself: Use the yarn run --top-level syntax to invoke the generator from the project root (which has the warm up script that downloads the .jar (for package.json files that declare the openapi generator CLI as their own dependency as well).

lerna-lite ERR! corepack yarn run codegen exited 1 in '@hyperledger/cactus-plugin-persistence-ethereum'
lerna-lite ERR! corepack yarn run codegen stdout:

> @hyperledger/cactus-plugin-persistence-ethereum@2.0.0-rc.1 generate-sdk
> run-p 'generate-sdk:*'


> @hyperledger/cactus-plugin-persistence-ethereum@2.0.0-rc.1 generate-sdk:typescript-axios
> openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore


> @hyperledger/cactus-plugin-persistence-ethereum@2.0.0-rc.1 generate-sdk:go
> openapi-generator-cli generate -i ./src/main/json/openapi.json -g go -o ./src/main/go/generated/openapi/go-client/ --git-user-id hyperledger --git-repo-id $(echo $npm_package_name | replace @hyperledger/ "" -z)/src/main/go/generated/openapi/go-client --package-name $(echo $npm_package_name | replace @hyperledger/ "" -z)  --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore

Download 6.6.0 ...
Download 6.6.0 ...
Downloaded 6.6.0
Downloaded 6.6.0
lerna-lite ERR! corepack yarn run codegen stderr:
Error: An unexpected error occurred while trying to open file /home/peter/a/cacti-upstream/packages/cactus-plugin-persistence-ethereum/node_modules/@openapitools/openapi-generator-cli/versions/6.6.0.jar
npm ERR! Lifecycle script `generate-sdk:go` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: @hyperledger/cactus-plugin-persistence-ethereum@2.0.0-rc.1 
npm ERR!   at location: /home/peter/a/cacti-upstream/packages/cactus-plugin-persistence-ethereum 
ERROR: "generate-sdk:go" exited with 1.
npm ERR! Lifecycle script `generate-sdk` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: @hyperledger/cactus-plugin-persistence-ethereum@2.0.0-rc.1 
npm ERR!   at location: /home/peter/a/cacti-upstream/packages/cactus-plugin-persistence-ethereum 
ERROR: "codegen:openapi" exited with 1.
lerna-lite ERR! corepack yarn run codegen exited 1 in '@hyperledger/cactus-plugin-persistence-ethereum'
lerna-lite WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.
file:///home/peter/a/cacti-upstream/node_modules/@lerna-lite/core/node_modules/execa/lib/error.js:60
                error = new Error(message);
                        ^

Error: Command failed with exit code 1: corepack yarn run codegen
Error: An unexpected error occurred while trying to open file /home/peter/a/cacti-upstream/packages/cactus-plugin-persistence-ethereum/node_modules/@openapitools/openapi-generator-cli/versions/6.6.0.jar
npm ERR! Lifecycle script `generate-sdk:go` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: @hyperledger/cactus-plugin-persistence-ethereum@2.0.0-rc.1 
npm ERR!   at location: /home/peter/a/cacti-upstream/packages/cactus-plugin-persistence-ethereum 
ERROR: "generate-sdk:go" exited with 1.
npm ERR! Lifecycle script `generate-sdk` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: @hyperledger/cactus-plugin-persistence-ethereum@2.0.0-rc.1 
npm ERR!   at location: /home/peter/a/cacti-upstream/packages/cactus-plugin-persistence-ethereum 
ERROR: "codegen:openapi" exited with 1.

> @hyperledger/cactus-plugin-persistence-ethereum@2.0.0-rc.1 generate-sdk
> run-p 'generate-sdk:*'


> @hyperledger/cactus-plugin-persistence-ethereum@2.0.0-rc.1 generate-sdk:typescript-axios
> openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore


> @hyperledger/cactus-plugin-persistence-ethereum@2.0.0-rc.1 generate-sdk:go
> openapi-generator-cli generate -i ./src/main/json/openapi.json -g go -o ./src/main/go/generated/openapi/go-client/ --git-user-id hyperledger --git-repo-id $(echo $npm_package_name | replace @hyperledger/ "" -z)/src/main/go/generated/openapi/go-client --package-name $(echo $npm_package_name | replace @hyperledger/ "" -z)  --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore

Download 6.6.0 ...
Download 6.6.0 ...
Downloaded 6.6.0
Downloaded 6.6.0
    at makeError (file:///home/peter/a/cacti-upstream/node_modules/@lerna-lite/core/node_modules/execa/lib/error.js:60:11)
    at handlePromise (file:///home/peter/a/cacti-upstream/node_modules/@lerna-lite/core/node_modules/execa/index.js:124:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async file:///home/peter/a/cacti-upstream/node_modules/p-queue/dist/index.js:187:36 {
  shortMessage: 'Command failed with exit code 1: corepack yarn run codegen',
  command: 'corepack yarn run codegen',
  escapedCommand: 'corepack yarn run codegen',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: '\n' +
    '> @hyperledger/cactus-plugin-persistence-ethereum@2.0.0-rc.1 generate-sdk\n' +
    "> run-p 'generate-sdk:*'\n" +
    '\n' +
    '\n' +
    '> @hyperledger/cactus-plugin-persistence-ethereum@2.0.0-rc.1 generate-sdk:typescript-axios\n' +
    '> openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore\n' +
    '\n' +
    '\n' +
    '> @hyperledger/cactus-plugin-persistence-ethereum@2.0.0-rc.1 generate-sdk:go\n' +
    '> openapi-generator-cli generate -i ./src/main/json/openapi.json -g go -o ./src/main/go/generated/openapi/go-client/ --git-user-id hyperledger --git-repo-id $(echo $npm_package_name | replace @hyperledger/ "" -z)/src/main/go/generated/openapi/go-client --package-name $(echo $npm_package_name | replace @hyperledger/ "" -z)  --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore\n' +
    '\n' +
    'Download 6.6.0 ...\n' +
    'Download 6.6.0 ...\n' +
    'Downloaded 6.6.0\n' +
    'Downloaded 6.6.0',
  stderr: 'Error: An unexpected error occurred while trying to open file /home/peter/a/cacti-upstream/packages/cactus-plugin-persistence-ethereum/node_modules/@openapitools/openapi-generator-cli/versions/6.6.0.jar\n' +
    'npm ERR! Lifecycle script `generate-sdk:go` failed with error: \n' +
    'npm ERR! Error: command failed \n' +
    'npm ERR!   in workspace: @hyperledger/cactus-plugin-persistence-ethereum@2.0.0-rc.1 \n' +
    'npm ERR!   at location: /home/peter/a/cacti-upstream/packages/cactus-plugin-persistence-ethereum \n' +
    'ERROR: "generate-sdk:go" exited with 1.\n' +
    'npm ERR! Lifecycle script `generate-sdk` failed with error: \n' +
    'npm ERR! Error: command failed \n' +
    'npm ERR!   in workspace: @hyperledger/cactus-plugin-persistence-ethereum@2.0.0-rc.1 \n' +
    'npm ERR!   at location: /home/peter/a/cacti-upstream/packages/cactus-plugin-persistence-ethereum \n' +
    'ERROR: "codegen:openapi" exited with 1.',
  cwd: '/home/peter/a/cacti-upstream/packages/cactus-plugin-persistence-ethereum',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false,
  pkg: Package {
    _id: '',
    isBumpOnlyVersion: false,
    licensePath: '',
    localDependencies: Map(0) {},
    name: '@hyperledger/cactus-plugin-persistence-ethereum',
    [Symbol(location)]: '/home/peter/a/cacti-upstream/packages/cactus-plugin-persistence-ethereum',
    [Symbol(resolved)]: Result {
      type: 'directory',
      registry: undefined,
      where: '/home/peter/a/cacti-upstream',
      raw: '@hyperledger/cactus-plugin-persistence-ethereum@file:packages/cactus-plugin-persistence-ethereum',
      name: '@hyperledger/cactus-plugin-persistence-ethereum',
      escapedName: '@hyperledger%2fcactus-plugin-persistence-ethereum',
      scope: '@hyperledger',
      rawSpec: 'file:packages/cactus-plugin-persistence-ethereum',
      saveSpec: 'file:packages/cactus-plugin-persistence-ethereum',
      fetchSpec: '/home/peter/a/cacti-upstream/packages/cactus-plugin-persistence-ethereum',
      gitRange: undefined,
      gitCommittish: undefined,
      gitSubdir: undefined,
      hosted: undefined
    },
    [Symbol(rootPath)]: '/home/peter/a/cacti-upstream',
    [Symbol(scripts)]: {
      build: 'npm run build-ts && npm run build:dev:backend:postbuild',
      'build-ts': 'tsc',
      'build:dev:backend:postbuild': 'npm run copy-sql && npm run copy-yarn-lock',
      codegen: "run-p 'codegen:*'",
      'codegen:openapi': 'npm run generate-sdk',
      'copy-sql': 'mkdir -p ./dist/lib/main/ && cp -Rfp ./src/main/sql ./dist/lib/main/',
      'copy-yarn-lock': 'mkdir -p ./dist/lib/ && cp -rfp ../../yarn.lock ./dist/yarn.lock',
      'generate-sdk': "run-p 'generate-sdk:*'",
      'generate-sdk:typescript-axios': 'openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore',
      'generate-sdk:go': 'openapi-generator-cli generate -i ./src/main/json/openapi.json -g go -o ./src/main/go/generated/openapi/go-client/ --git-user-id hyperledger --git-repo-id $(echo $npm_package_name | replace @hyperledger/ "" -z)/src/main/go/generated/openapi/go-client --package-name $(echo $npm_package_name | replace @hyperledger/ "" -z)  --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore'
    }
  }
}

Copy link
Contributor

@RafaelAPB RafaelAPB left a comment

Choose a reason for hiding this comment

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

LGTM, concur with Peter and Michal on fixing the CI. Any specific reason why we are adding go SDKs to all plugins? (Sorry for my absence recently but I've been out due to illness). I was going to add a Go SDK for the SATP plugin in any case. TS + Go seem like very reasonable options.

@jagpreetsinghsasan
Copy link
Contributor Author

@jagpreetsinghsasan I'm not sure either TBH, but there's definitely race conditions in codegen because when I try to run it locally it crashes with the logs pasted below. So, I'd say let's fix the race condition first so that it reliably runs on my machine too and then we can establish an additional data point after that (whether it works on my machine or fails like it does on the CI with those 2 extra files ending up in the diff somehow). Once I'm able to reproduce the issue one way or another then I can try and investigate it more closely.

For the race condition itself: Use the yarn run --top-level syntax to invoke the generator from the project root (which has the warm up script that downloads the .jar (for package.json files that declare the openapi generator CLI as their own dependency as well).

I am not sure why is it failing on your machine @petermetz , but even with the yarn run -T codegen script, no new change happened on my machine. Also, why do you think it is a race condition, because from the logs I can see the generator jar getting download and then the issue happened at accessing the jar? As every step of the codegen happens sequentially, this error most likely seem to be a corrupt download or incomplete download (intermittent). Tried this multiple times on my end, even by limiting the internet speed to almost 10mbps, but still didnt faced the race condition once.
Also a suggestion, this seems to be good library for downloading stuffs.

@outSH
Copy link
Contributor

outSH commented Jul 9, 2024

@jagpreetsinghsasan @petermetz Worked on my machine as well, the CI is still failing though (yarn_codegen and yarn_custom_checks)

Copy link
Contributor

@outSH outSH left a comment

Choose a reason for hiding this comment

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

Since the failing checks are required I'll give apporval not to slow down the merge once it's fixed :)

@petermetz
Copy link
Contributor

LGTM, concur with Peter and Michal on fixing the CI. Any specific reason why we are adding go SDKs to all plugins? (Sorry for my absence recently but I've been out due to illness). I was going to add a Go SDK for the SATP plugin in any case. TS + Go seem like very reasonable options.

@RafaelAPB My own take: Adding the client implementations it to all the plugins increases the chance that people will find the project useful, e.g. we don't know which plugin someone would be starting off with but whichever it is they'd be happy to have a go client (assuming they'd want a go client).

The downside is that the codegen script is getting longer and longer so this change also puts it in the spotlight that we should have the script altered in a way that it either

  1. only regenerates sources for packages that have changed openapi.json files since the last commit or
  2. something else that optimizes the build process so that we don't run redundant operations 99% of the time (most contributors will only change one openapi.json file at a time in a single package and running the openapi codegenerator for ~30 (now ~60) times is wasteful and slow.

@jagpreetsinghsasan jagpreetsinghsasan force-pushed the feature-393b branch 2 times, most recently from c55bbcc to 861e5f5 Compare July 13, 2024 10:59
@RafaelAPB
Copy link
Contributor

LGTM, concur with Peter and Michal on fixing the CI. Any specific reason why we are adding go SDKs to all plugins? (Sorry for my absence recently but I've been out due to illness). I was going to add a Go SDK for the SATP plugin in any case. TS + Go seem like very reasonable options.

@RafaelAPB My own take: Adding the client implementations it to all the plugins increases the chance that people will find the project useful, e.g. we don't know which plugin someone would be starting off with but whichever it is they'd be happy to have a go client (assuming they'd want a go client).

The downside is that the codegen script is getting longer and longer so this change also puts it in the spotlight that we should have the script altered in a way that it either

  1. only regenerates sources for packages that have changed openapi.json files since the last commit or
  2. something else that optimizes the build process so that we don't run redundant operations 99% of the time (most contributors will only change one openapi.json file at a time in a single package and running the openapi codegenerator for ~30 (now ~60) times is wasteful and slow.

I do agree with that. Do you have any solution in mind? I thought about publishing the packages in third-party repos (such as npm or others but we risk some decentralization. We could publish them in separate repos that have a job such that it scraps updates to the open API files, generates, and publishes the SDKs.

@petermetz
Copy link
Contributor

petermetz commented Jul 18, 2024

LGTM, concur with Peter and Michal on fixing the CI. Any specific reason why we are adding go SDKs to all plugins? (Sorry for my absence recently but I've been out due to illness). I was going to add a Go SDK for the SATP plugin in any case. TS + Go seem like very reasonable options.

@RafaelAPB My own take: Adding the client implementations it to all the plugins increases the chance that people will find the project useful, e.g. we don't know which plugin someone would be starting off with but whichever it is they'd be happy to have a go client (assuming they'd want a go client).
The downside is that the codegen script is getting longer and longer so this change also puts it in the spotlight that we should have the script altered in a way that it either

  1. only regenerates sources for packages that have changed openapi.json files since the last commit or
  2. something else that optimizes the build process so that we don't run redundant operations 99% of the time (most contributors will only change one openapi.json file at a time in a single package and running the openapi codegenerator for ~30 (now ~60) times is wasteful and slow.

I do agree with that. Do you have any solution in mind? I thought about publishing the packages in third-party repos (such as npm or others but we risk some decentralization. We could publish them in separate repos that have a job such that it scraps updates to the open API files, generates, and publishes the SDKs.

@RafaelAPB I laid out my ideas here in more detail: https://github.com/hyperledger/cacti/issues/3403

I'm also not opposed to creating more repositories as long as other people volunteer to be the principal maintainer on those repositories (the overhead of managing one repo is more than enough for me so I can't volunteer to take care of the admin chores of any more repositories unfortunately)

@petermetz
Copy link
Contributor

petermetz commented Jul 18, 2024

@jagpreetsinghsasan Attaching the codegen failure log: looks like more of the same where the yarn --top-level parameter is needed to be specified in the openapi-generator-cli invoking npm scripts

2024-07-18T20-11-13-yarn-codegen-crash.log

@jagpreetsinghsasan
Copy link
Contributor Author

jagpreetsinghsasan commented Jul 18, 2024

I'm also not opposed to creating more repositories as long as other people volunteer to be the principal maintainer on those repositories (the overhead of managing one repo is more than enough for me so I can't volunteer to take care of the admin chores of any more repositories unfortunately)

@petermetz , this is actually a good idea. Would also reduce the chores on the main repo. We had similar issues maintaining all possible examples in Bevel, so we divided the project into 2 parts, one having the core code and other holding the examples

@jagpreetsinghsasan
Copy link
Contributor Author

@jagpreetsinghsasan Attaching the codegen failure log: looks like more of the same where the yarn --top-level parameter is needed to be specified in the openapi-generator-cli invoking npm scripts

2024-07-18T20-11-13-yarn-codegen-crash.log

I will update that asap and re-request for review

@jagpreetsinghsasan
Copy link
Contributor Author

jagpreetsinghsasan commented Jul 18, 2024

@jagpreetsinghsasan Attaching the codegen failure log: looks like more of the same where the yarn --top-level parameter is needed to be specified in the openapi-generator-cli invoking npm scripts

2024-07-18T20-11-13-yarn-codegen-crash.log

@petermetz will that adding to generate-sdk do the job or shall I add it to all individual scripts like generate-sdk:typescript (Unable to reproduce this error on my system thus asking)?

@petermetz
Copy link
Contributor

@jagpreetsinghsasan Attaching the codegen failure log: looks like more of the same where the yarn --top-level parameter is needed to be specified in the openapi-generator-cli invoking npm scripts
2024-07-18T20-11-13-yarn-codegen-crash.log

@petermetz will that adding to generate-sdk do the job or shall I add it to all individual scripts like generate-sdk:typescript (Unable to reproduce this error on my system thus asking)?

@jagpreetsinghsasan I'd say yes. That way it's always pointing to the same installation of the generator cli package and therefore re-uses the pre-downloaded .jar file that we get in the warmup codegen script in the root package.json

@jagpreetsinghsasan jagpreetsinghsasan force-pushed the feature-393b branch 2 times, most recently from 73c7a44 to 68674ef Compare July 22, 2024 04:57
@jagpreetsinghsasan
Copy link
Contributor Author

@petermetz I am not sure why the tools:validate-bundle-names is failing (...umd.min.js, ....web.umd.js and ....web.umd.min.js files missing for cactus-plugin-persistence-fabric) as I haven't even touched anything related to that
image

@outSH
Copy link
Contributor

outSH commented Jul 22, 2024

@jagpreetsinghsasan You're adding the webpack scripts that I've removed from this package in PR merged 4 days ago, I guess that is triggering this error. Remove the webpack scripts and it should pass I think :)

@jagpreetsinghsasan
Copy link
Contributor Author

jagpreetsinghsasan commented Jul 22, 2024

Oh right @outSH
I will fix it

Update: Fixed

@jagpreetsinghsasan
Copy link
Contributor Author

@petermetz I have updated the code. The codegen seems fine now (it never failed for me, so can you verify on your end?)

Copy link
Contributor

@petermetz petermetz left a comment

Choose a reason for hiding this comment

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

@jagpreetsinghsasan LGMT just please fix the DCI lint check.
I think you can ignore **/src/main/go/generated/openapi/go-client/client.go in .dcilintignore and then it should be OK. Just make sure to include an explanation that the generated sources that we don't control have the failing text in them.

    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 merged commit 9c4d9be into hyperledger-cacti:main Jul 25, 2024
142 of 144 checks passed
@petermetz petermetz deleted the feature-393b branch July 25, 2024 21:06
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.

build(api-client): generate java, go clients
4 participants