swagger-api / swagger-api/swagger-codegen

[TypeScript] Package structure error

Open
#9,822 0 comments 0 reactions 1 assignee View on GitHub

@HugoMario is already working on this.

Since May 8, 2020.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.