Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #3356
Closed
Open
Issue created Jul 14, 2019 by Administrator@rootContributor4 of 6 checklist items completed4/6 checklist items

[QUESTION] Why do error occur with `--ignore-file-override` option ?

Created by: yuji38kwmt

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

When I execute generate subcommand with --ignore-file-override option, the following error occurred. Why did error occurr ? Removing --ignore-file-override option, error did not occur.

$ java -Dapis   -DapiTests=false -DapiDocs=false -jar openapi-generator-cli-4.0.0.jar generate -g python -i petstore-simple.yaml -o out --ignore-file-override=openapi-generator-ignore
[main] INFO  o.o.codegen.DefaultGenerator - OpenAPI Generator: python (client)
[main] INFO  o.o.codegen.DefaultGenerator - Generator 'python' is considered stable.
[main] INFO  o.o.c.languages.PythonClientCodegen - Environment variable PYTHON_POST_PROCESS_FILE not defined so the Python code may not be properly formatted. To define it, try 'export PYTHON_POST_PROCESS_FILE="/usr/local/bin/yapf -i"' (Linux/Mac)
[main] INFO  o.o.c.languages.PythonClientCodegen - NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI). Exception in thread "main" java.lang.RuntimeException: Could not generate api file for 'animals'
        at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:666)
        at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:922)
        at org.openapitools.codegen.cmd.Generate.run(Generate.java:396)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:60)
Caused by: java.lang.NullPointerException
        at org.openapitools.codegen.ignore.CodegenIgnoreProcessor.allowsFile(CodegenIgnoreProcessor.java:145)
        at org.openapitools.codegen.DefaultGenerator.processTemplateToFile(DefaultGenerator.java:955)
        at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:617)
        ... 3 more
openapi-generator version
  • openapi-generator-cli-4.0.0.jar
  • java version "1.8.0_162"
OpenAPI declaration file content or url

petstore-simple.yaml

openapi: "3.0.0"
info:
  version: 1.0.0
  title: Swagger Petstore
  license:
    name: MIT
servers:
  - url: http://petstore.swagger.io/v1
paths:
  /pets/{petId}:
    get:
      summary: Info for a specific pet
      operationId: showPetById
      tags:
        - pets
        - animals
      parameters:
        - name: petId
          in: path
          required: true
          description: The id of the pet to retrieve
          schema:
            type: string
      responses:
        '200':
          description: Expected response to a valid request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pet"
components:
  schemas:
    Pet:
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        tag:
          type: string

openapi-generator-ignore file

openapi_client/api/pets_api.py
Command line used for generation
$ java -Dapis -DapiTests=false -DapiDocs=false \
 -jar openapi-generator-cli-4.0.0.jar generate \
 -g python -i petstore-simple.yaml \
 -o out --ignore-file-override=openapi-generator-ignore
Steps to reproduce
Related issues/PRs

I referred to Ignore file format

Assignee
Assign to
Time tracking