Сгенерированные исходники с API-First разработкой в ​​jhipster

Я пытаюсь создать новую службу в jhipster с помощью генератора openapi, но сгенерированные источники создаются в каталоге сборки (цели), поэтому бесполезно переопределять их и добавлять мою логику. Что я должен изменить в своем процессе?

Я создал код swagger и запустил генерацию исходников, как это предлагается в документации jhipster: https://www.jhipster.tech/doing-api-first-development/

openapi: '3.0.1'
info:
  title: 'Example'
  version: 0.0.1
servers:
  - url: http://localhost:8080
    description: Development server
  - url: https://localhost:8080
    description: Development server with TLS Profile
paths:
  /assessments/{reference}:
    get:
      summary: active assessments for a given reference
      operationId: getAssessmentsByDevice
      description: |
        By passing a unique identifier reference, you can get active assessments for that device
      parameters:
        - in: path
          name: reference
          description: unique device identifier
          required: true
          schema:
            type: string
      responses:
        '200':
          description: active assessments for a device
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
        '400':
          description: bad input parameter
        '404':
          description: reference not found

и работающий генератор:

[INFO] OpenAPI Generator: spring (server)
[INFO] Generator 'spring' is considered stable.
[INFO] ----------------------------------
[INFO] Environment variable JAVA_POST_PROCESS_FILE not defined so the Java code may not be properly formatted. To define it, try 'export JAVA_POST_PROCESS_FILE="/usr/local/bin/clang-format -i"' (Linux/Mac)
[INFO] NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).
[INFO] Invoker Package Name, originally not set, is now derived from api package name: com.hcb.happyratingmodel.web
[INFO] Processing operation getAssessmentsByDevice
[INFO] writing file C:\Users\cduquemarcos\Documents\Documentation\Projects\Personal\example\target\generated-sources\openapi\src\main\java\com\hcb\example\web\api\AssessmentsApiController.java
[INFO] writing file C:\Users\cduquemarcos\Documents\Documentation\Projects\Personal\example\target\generated-sources\openapi\src\main\java\com\hcb\example\web\api\AssessmentsApi.java
[INFO] writing file C:\Users\cduquemarcos\Documents\Documentation\Projects\Personal\example\target\generated-sources\openapi\src\main\java\com\hcb\example\web\api\AssessmentsApiDelegate.java
[INFO] writing file C:\Users\cduquemarcos\Documents\Documentation\Projects\Personal\example\target\generated-sources\openapi\src/main/java\com\hcb\example\web\api\ApiUtil.java
[INFO] writing file C:\Users\cduquemarcos\Documents\Documentation\Projects\Personal\example\target\generated-sources\openapi\.openapi-generator\VERSION
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] -----------------------------------------------------------------------

Я ожидал, что эти классы будут созданы в папке SRC и будут доступны для расширения моей реализацией. Правильно ли я понимаю? Должен ли я просто скопировать их вручную в исходную папку? Спасибо.


person carduque    schedule 05.09.2019    source источник
comment
Да, если вы хотите отредактировать их, вы можете скопировать их вручную. Плагин настроен таким образом, что источником правды является код openapi, и вы расширяете сгенерированный интерфейс.   -  person Pierre Besson    schedule 05.09.2019


Ответы (1)


Выходной путь по умолчанию: ${project.build.directory}/generated-sources/openapi. Вы можете изменить это, изменив его с помощью свойства output в настройках конфигурации или установив его глобально с помощью свойства openapi.generator.maven.plugin.output.

Более подробная информация и другие параметры конфигурации здесь: https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-maven-plugin

person mtazamaji    schedule 14.04.2021