OpenAPITools / OpenAPITools/openapi-generator-cli

[BUG] openapi-generator-cli fails silently when it cannot create openapitools.json

Ouverte
#386 1 commentaire 1 réaction 1 personne assignée Voir sur GitHub

@kay-schecker y travaille déjà.

Depuis le 18/6/2021.

bug
Langage dominant
TypeScript
Étoiles
2k
Forks
208
Merge moyen
7 h 12 min
PR mergées (30 j)
6

Description

🐛 Bug Report:

Describe the bug

openapi-generator-cli fails silently when it cannot create openapitools.json

Steps to Reproduce

Steps to reproduce the behavior:

~/openapi-test
❯ node --version
v12.15.0

~/openapi-test
❯ npm --version
6.13.4

~/openapi-test
❯ java --version
openjdk 11.0.6 2020-01-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.6+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.6+10, mixed mode)

❯ npm install @openapitools/openapi-generator-cli@2.3.5
...

~/openapi-test
❯ cat swagger.yaml
swagger: "2.0"
info:
  version: v1
  title: Our API
  description: The REST API for interacting with Our API
host: localhost:1234
schemes:
  - http
paths:
  "/api/job/{jobid}/status":
    get:
      summary: getJobStatus
      description: Get the current status for a job.
      operationId: getJobStatus
      produces:
        - application/json;charset=utf-8
      parameters:
        - required: true
          in: path
          name: jobid
          type: string
      responses:
        "200":
          schema:
            $ref: "#/definitions/JobStatus"
          description: ""
        "404":
          description: "`jobid` not found"
definitions:
  JobStatus:
    type: string

~/openapi-test
❯ $(npm bin)/openapi-generator-cli generate -i swagger.yaml --generator-name typescript-fetch
...

~/openapi-test
❯ ls apis/
DefaultApi.ts  index.ts

~/openapi-test
❯ mkdir readonly

~/openapi-test
❯ chmod u-w readonly

~/openapi-test
❯ cd readonly

~/openapi-test/readonly
❯ touch test
touch: cannot touch 'test': Permission denied

~/openapi-test/readonly
❯ $(npm bin)/openapi-generator-cli generate -i ../swagger.yaml --generator-name typescript-fetch --output ..

~/openapi-test/readonly
❯ echo $?
1

~/openapi-test/readonly
❯ chmod u+w .

~/openapi-test/readonly
❯ cp ../openapitools.json .

~/openapi-test/readonly
❯ ls
openapitools.json

~/openapi-test/readonly
❯ chmod u-w .

~/openapi-test/readonly
❯ $(npm bin)/openapi-generator-cli generate -i ../swagger.yaml --generator-name typescript-fetch --output ..
... (works)
Expected behavior

The command prints an explanation of why the command is failing, or any next steps on how to debug

Operation System (please complete the following information):
  • OS: Ubuntu 18 LTS
Package System (please complete the following information):

See reproduction for versions

Additional context

This cost me many, many hours of debugging because it only occurred in CI where volumes with no writes expected are mounted readonly, and during local testing we tend to already have an openapitools.json

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.