jhipster openapi-client , failed to genereate client code - jhipster

i'd like to generate code basing on openapi yaml file from jhipster, refering https://www.jhipster.tech/doing-api-first-development/ i have done this:
D:\dev\jhipster-app\openapi-demo>jhipster openapi-client
INFO! Using JHipster version installed globally
INFO! Executing jhipster:openapi-client
Welcome to the JHipster OpenApi client Sub-Generator
? Where do you want to import your OpenAPI/Swagger specification from ? From a custom specification file or endpoint
? Where is your Swagger/OpenAPI spec (URL or path) ? http://petstore.swagger.io/v2/swagger.json
? What is the unique name for your API client (please avoid using Java keywords) ? petstore
? Do you want to save this config for future reuse ? No
and it prompts the error:
Unable to find package.json. Reference to npm script (name: openapi-client:petstore, data:openapi-generator generate -g spring -i http://petstore.swagger.io/v2/swagger.json -p library=spring-cloud -p apiPackage=undefined.client.petstore.api -p modelPackage=undefined.client.petstore.model -p basePackage=undefined.client -p configPackage=undefined.client.petstore -p title=petstore -p artifactId=petstore -p supportingFiles=ApiKeyRequestInterceptor.java --skip-validate-spec) not added.
ERROR! Cannot read property 'endsWith' of undefined
TypeError: Cannot read property 'endsWith' of undefined
at module.exports.getMicroserviceAppName (D:\users\dev\npm\node_modules\generator-jhipster\generators\generator-base.js:1252:66)
Would someone have any idea to fix it?

I download the sample pestore.yaml from swagger and put it to an existing project 's "src/main/resources/swagger/" folder with renaming to api.yml.
and run jhipster openapi-client:
INFO! Using JHipster version installed locally in current project's node_modules
INFO! No custom sharedOptions found within blueprint: generator-jhipster-vuejs at /mnt/program/dev/github/jhipster-app/vuedemo/node_modules/generator-jhipster-vuejs
INFO! No custom commands found within blueprint: generator-jhipster-vuejs at /mnt/program/dev/github/jhipster-app/vuedemo/node_modules/generator-jhipster-vuejs
INFO! Executing jhipster:openapi-client
Welcome to the JHipster OpenApi client Sub-Generator
? What do you want to do ? Generate a new API client
? Where do you want to import your OpenAPI/Swagger specification from ? From the api.yml spec of an existing Jhipster project
? Enter the path to the jhipster project root directory /program/github/jhipster-app/vuedemo
? What is the unique name for your API client (please avoid using Java keywords) ? petstore
? Do you want to save this config for future reuse ? No
the result seems ok:
Generating npm script for generating client code petstore (/program/github/jhipster-app/vuedemo/src/main/resources/swagger/api.yml)
identical .openapi-generator-ignore
identical pom.xml
identical src/main/java/com/demo/VuedemoApp.java
identical package.json
force .yo-rc.json
Generating client for petstore
> vuedemo#0.0.0 openapi-client:petstore /mnt/program/dev/github/jhipster-app/vuedemo
> openapi-generator generate -g spring -i /program/github/jhipster-app/vuedemo/src/main/resources/swagger/api.yml -p library=spring-cloud -p apiPackage=com.demo.client.petstore.api -p modelPackage=com.demo.client.petstore.model -p basePackage=com.demo.client -p configPackage=com.demo.client.petstore -p title=petstore -p artifactId=petstore -p supportingFiles=ApiKeyRequestInterceptor.java --skip-validate-spec
Usage: openapi-generator [options] [command]
Options:
-V, --version output the version number
-d, --sdkDir <sdkDir> sdkDir, default: process.cwd()/service
-t, --templatePath <templatePath> templatePath
-t, --type <type> ts/js, default ts
-c, --camelCase <camelCase> filename style, true 为大驼峰,lower 为小驼峰
-d, --sdkDir <sdkDir> sdkDir, default: process.cwd()/service
-t, --templatePath <templatePath> templatePath
-t, --type <type> ts/js, default ts
-c, --camelCase <camelCase> filename style, true 为大驼峰,lower 为小驼峰
-h, --help output usage information
Commands:
url <url> swagger2/oas3 json data url
data <filePath> swagger2/oas3 json data file
config <cfgPath> config path
*
✔ Succesfully generated petstore spring client
End of openapi-client generator
INFO! Congratulations, JHipster execution is complete!
but I can't find any code generated in src/main/webapp

jhipster openapi-client generate java code for the server, not typescript code for the client :(

Related

DSBulk CSV Load Failure to DataStax Astra Cassandra Database, missing file config.json

I am trying to load a csv into a database in DataStax Astra using the DSBulk tool.
Here is the command I ran minus the sensitive details:
dsbulk load -url D:\\App\\data.csv -k data -t data -b D:\\App\\secure-connect-myapp -u username -p password
Here is the error I get back:
Operation LOAD_20221206-004421-512000 failed: Invalid bundle: missing file config.json.
Here is the full log:
2022-12-06 00:44:21 INFO Username and password provided but auth provider not specified, inferring PlainTextAuthProvider
2022-12-06 00:44:21 INFO A cloud secure connect bundle was provided: ignoring all explicit contact points.
2022-12-06 00:44:21 INFO A cloud secure connect bundle was provided and selected operation performs writes: changing default consistency level to LOCAL_QUORUM.
2022-12-06 00:44:21 INFO Operation directory: C:\Program Files\dsbulk-1.10.0\bin\logs\LOAD_20221206-004421-512000
2022-12-06 00:44:21 ERROR Operation LOAD_20221206-004421-512000 failed: Invalid bundle: missing file config.json.
java.lang.IllegalStateException: Invalid bundle: missing file config.json
at com.datastax.oss.driver.internal.core.config.cloud.CloudConfigFactory.createCloudConfig(CloudConfigFactory.java:114)
at com.datastax.oss.driver.api.core.session.SessionBuilder.buildDefaultSessionAsync(SessionBuilder.java:876)
at com.datastax.oss.driver.api.core.session.SessionBuilder.buildAsync(SessionBuilder.java:817)
at com.datastax.oss.driver.api.core.session.SessionBuilder.build(SessionBuilder.java:835)
at com.datastax.oss.dsbulk.workflow.commons.settings.DriverSettings.newSession(DriverSettings.java:560)
at com.datastax.oss.dsbulk.workflow.load.LoadWorkflow.init(LoadWorkflow.java:145)
at com.datastax.oss.dsbulk.runner.WorkflowThread.run(WorkflowThread.java:52)
The error says that config.json is missing, but it isn't. So I'm stuck. Unless it's looking somewhere other than in the bundle I specified, but the bundle definitely has the config.json file.
This error:
...
java.lang.IllegalStateException: Invalid bundle: missing file config.json
at com.datastax.oss.driver.internal.core.config.cloud.CloudConfigFactory.createCloudConfig(CloudConfigFactory.java:114)
...
indicates that the Java driver bundled with DSBulk is unable to connect to your Astra DB because it couldn't get the configuration details from the secure connect bundle.
Please make sure that the valid secure bundle ZIP is accessible to DSBulk. You need to provide the path to the ZIP file, not just the directory. For example:
$ dsbulk ... -b /path/to/secure-connect-db.zip ...
Please check the path in your command then try again. Cheers!
👉 Please support the Apache Cassandra community by hovering over the cassandra tag above and click on Watch tag. 🙏 Thanks!
In order for you to leverage DataStax Bulk Loader (aka DSBulk, in short), you would need to pass in the secure connect bundle (SCB) correctly. What I mean when I say is that you need either the fully qualified path or the relative path to the SCB file.
The correct command in your case would look like:
./dsbulk load -url 'D:\\App\\data.csv' -k data -t data -b 'D:\\App\\secure-connect-myapp.zip' -u username -p password
Note that -b option takes in the full SCB filename along with .zip file extension.
Other Resources:
Load data using DSBulk into DataStax Astra DB
-b command-line option reference
BONUS TIP: One could easily configure everything within a configuration file and leverage that. See documentation for additional details.

SHAREDLIBRARYNAME Utimaco is not referring When I start signserver with docker

I start signserver with docker:
docker run -it --rm --name signserver \
-p 80:8080 -p 443:8443 \
-e CRYPTO_SERVER_IP=**** \
-v /ca-cert.pem:/mnt/external/secrets/tls/cas/ManagementCA.crt \
signserver:1.0
Now, i need connect signserver to PKCS11 on HSM.I has changed signserver-deploy.configuaration:
cryptotoken.p11.lib.30.name=Utimaco
cryptotoken.p11.lib.30.file=/opt/utimaco/p11/libcs_pkcs11_R3.so
Then I add PKCS#11 crypto worker from template,and i change the configuration:
WORKERGENID1.SHAREDLIBRARYNAME=Utimaco
The PKCS#11 crypto worker status is offline,so i active it and enter authentication Code.but i get errors:
- Failed to initialize crypto token: SHAREDLIBRARYNAME Utimaco is not referring to a defined value
Could you please help me
Thank you so much!
This is being discussed at the SignServer CE project's GitHub Discussions page where it is being answered that:
The current SignServer CE container does not support changing configuration in the signserver_deploy.properties.
A theoretical short-term solution for doing this could be something like this:
Find where the signserver.ear is in the container (probably under the appserver deployments folder and it might be folder instead of a ZIP file).
Find the JAR file which has the configuration, likely lib/SignServer-Common.jar
Find the properties file in that JAR file, something like org/signserver/common/.../signservercompile.properties
Change the property in that file and save it back to the ZIP file

how to provide default value for anlytics to jhipster command?

I am trying to build the jhipster automatically, kindly help me to give a default value to analytics while building the jhipster file.
jhipster jdl file.jdl --no-insight
Above command will build and monolith application, after some steps it asks a question for analytics, how do you provide a default value to anlytics in jhipster command or jdl file ?
Insights question
Analytics question
I see below options, but I dont see anything for anlytics
-V, --version output the version number
--blueprints <value> A comma separated list of one or more generator blueprints to use for the sub generators, e.g. --blueprints kotlin,vuejs
--force-insight Force insight
--no-insight Disable insight
--force Override every file (default: false)
--dry-run Print conflicts (default: false)
--whitespace Whitespace changes will not trigger conflicts (default: false)
--bail Fail on first conflict (default: false)
--skip-regenerate Don't regenerate identical files (default: false)
--skip-yo-resolve Ignore .yo-resolve files (default: false)
-d, --debug enable debugger
-h, --help display help for command
Set an env variable as export NG_CLI_ANALYTICS=ci before we run jhipster jdl app.jdl --no-insight

Can I execute presto CLI without specifying --server or --catalog

I would like to know where, if it is possible, I can configure default catalog and server values to use when executing the presto CLI.
Presto CLI info:
ls -lthr /opt/presto-server-0.169/presto
/opt/presto-server-0.169/presto -> presto-cli-0.169-executable.jar
And instead of executing:
/opt/presto-server-0.169/presto --server localhost:6666 --schema abc --catalog catalog-1
I would like to execute:
/opt/presto-server-0.169/presto
with it picking up localhost:6666 as my server and catalog-1 as my catalog. I would like to specify the schema once I make the connection.
Any help will be appreciated!
Thanks.
There is no such option to set host in console lazily. The server needs to be defined upfront by default localhost:8080 is used.
If you cannot pass proper arguments to the presto-cli and cannot use the default server host, you can change default values in presto-cli source code and compile your version.
You need to checkout project at github.
Change default values in ClientOptions.
Package jar for presto cli: cd presto-cli && mvn package
You can find a jar in target/presto-cli-0.201-SNAPSHOT.jar
For schema/catalog, you can define it in the console itself with USE command. The syntax as follows: USE [<catalog>.]<schema>.
Please note that with each version of presto you need also compile and maintain your own version of presto-cli, which might become a burden quite soon.

Creating a client stub using swagger-codegen

I have been trying to create a client stub for my front-end client using swagger-codegen.
Following is the command that I've been using:
java -jar swagger-codegen-cli-2.2.2.jar generate -i "docs-endpoint" -l nodejs-server -o retrofit/ -c config.json
And following is the config :
{
"apiPackage": "com.xyz.api",
"modelPackage": "com.xyz.model",
"groupId":"com.xyz.prototype",
"artifactVersion":"1.0-SNAPSHOT",
"artifactId":"xyz-api",
"library":"retrofit"
}
But I am getting the following error :
Exception in thread "main" java.lang.RuntimeException: unknown library: retrofit
at io.swagger.codegen.DefaultCodegen.setLibrary(DefaultCodegen.java:3159)
at io.swagger.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:409)
at io.swagger.codegen.cmd.Generate.run(Generate.java:232)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:41)
If I remove the library from the config, it's working fine.Could someone please tell what am I doing wrong?
I think you want to generate a Java API client instead and here is the command:
java -jar swagger-codegen-cli-2.2.2.jar generate -i "docs-endpoint" -ljava -o retrofit/ -c config.json
I would suggest retrofit2 instead of retrofit as retrofit is no longer actively maintained.
You may want build the Swagger Codegen CLI JAR from the latest master, which contains a lot of enhancements and bug fixes.

Resources