Skip to content

[TypeScript] Package structure error #9822

Description

@hypery2k

Description

When using the codegen plugin for generating Angular API package the package structure seems to be not resolvable:


Bundling to UMD
[INFO] ERROR: Could not resolve './absencesController.service' from dist/fesm5/my-api-client.js

What's really strange here, it was working about a week ago, not sure if it's just was same build cache stuff

Swagger-codegen version

3.0.12

Swagger declaration file content or url

not related to swagger declaration

Command line used for generation

Just the Maven Plugin:

<plugin>
            <groupId>io.swagger.codegen.v3</groupId>
            <artifactId>swagger-codegen-maven-plugin</artifactId>
            <version>${swagger-codegen-plugin.version}</version>
            <executions>
              <execution>
                <id>generate-client-stubs</id>
                <phase>test</phase>
                <goals>
                  <goal>generate</goal>
                </goals>
                <configuration>
                  <output>target/frontend/api-client</output>
                  <inputSpec>${project.build.directory}/swagger.json</inputSpec>
                  <language>typescript-angular</language>
                  <apiPackage>api</apiPackage>
                  <modelPackage>model</modelPackage>
                  <configOptions>
                    <npmName>myapi-client</npmName>
                    <npmVersion>${project.version}</npmVersion>
                    <ngVersion>8.2.0</ngVersion>
                  </configOptions>
                </configuration>
              </execution>
            </executions>
          </plugin>
Steps to reproduce

Just add the maven plugin.

Will try to add a java testcase for it

Related issues/PRs

N/A

Suggest a fix/enhancement

This is caused by this structure:

api-client
  |-model
  |  \-model.ts
  |-package.json
...

model.ts should be named index.ts, because there seems errors when using the same name for folder and imported file.

Going to try a PR for this

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions