When it comes to generating code for typescript-angular
using the openapi-generator-maven-plugin, my process involves configuring an XML file in the following manner:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>4.2.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/../my_server/openapi.json</inputSpec>
<generatorName>typescript-angular</generatorName>
<output>${project.basedir}</output>
<npmName>myClientRest</npmName>
<npmRepository>http://localhost:8444/repository/npm-releases/</npmRepository>
<providedInRoot>true</providedInRoot>
<apiModulePrefix>my</apiModulePrefix>
<stringEnums>true</stringEnums>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Despite a successful output from the generator run, I still face the absence of a crucial package.json
file necessary for executing npm install
. This was previously handled seamlessly with a swagger plugin that auto-generated the package.json
file.
Therefore, my inquiry pertains to why the package.json
file is not automatically generated and what steps can be taken to remedy this issue?
The log output post-generation seems satisfactory as follows:
[INFO] --- openapi-generator-maven-plugin:4.2.0:generate (default) @ client ---
[INFO] OpenAPI Generator: typescript-angular (client)
[INFO] Generator 'typescript-angular' is considered stable.
[INFO] Hint: Environment variable 'TS_POST_PROCESS_FILE' (optional) not defined. E.g. to format the source code, please try 'export TS_POST_PROCESS_FILE="/usr/local/bin/prettier --write"' (Linux/Mac)
[INFO] Note: To enable file post-processing, 'enablePostProcessFile' must be set to
true
(--enable-post-process-file for CLI).[INFO] generating code for Angular 8.0.0 ...
[INFO] (you can select the angular version by setting the additionalProperty ngVersion)
[INFO] writing file C:\my-client-rest\api\default.service.ts
[INFO] writing file C:\my-client-rest\model\models.ts
[INFO] writing file C:\my-client-rest\api\api.ts
[INFO] writing file C:\my-client-rest\index.ts
[INFO] writing file C:\my-client-rest\api.module.ts
[INFO] writing file C:\my-client-rest\configuration.ts
[INFO] writing file C:\my-client-rest\variables.ts
[INFO] writing file C:\my-client-rest\encoder.ts
[INFO] writing file C:\my-client-rest.gitignore
[INFO] writing file C:\my-client-rest\git_push.sh
[INFO] writing file C:\my-client-rest\README.md
[INFO] writing file C:\my-client-rest.openapi-generator\VERSION