Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to skip "form" model generation #700

Merged
merged 7 commits into from
Aug 17, 2018
Merged

Conversation

wing328
Copy link
Member

@wing328 wing328 commented Jul 31, 2018

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

To fix #405

To enable skipping "form" model generation, please use the following as stated in the updated doc:

java -DskipFormModel=true

@jmini
Copy link
Member

jmini commented Aug 2, 2018

As discussed on gitter:

I think that the default should be to generate all models.
I prefer generating too much code for them and having a project that works in all cases than generating something that do not compile because of missing classes.

If we do so, I tend to prefer option that are activated with true: skipFormModel or something similar.

cc @jimschubert

@jimschubert
Copy link
Member

I agree with Jérémie. If we attempt to get clever with optimizing what gets generated, it can be wrong, confusing, or only applicable to the built-in templates.

@wing328
Copy link
Member Author

wing328 commented Aug 3, 2018

👌 let me update the PR accordingly.

@wing328 wing328 changed the title Add an option to generate all models Add an option to skip "form" model generation Aug 5, 2018
@wing328
Copy link
Member Author

wing328 commented Aug 5, 2018

PR update. Please review when you guys have time.

@wing328 wing328 modified the milestones: 3.2.0, 3.2.1 Aug 6, 2018
@wing328 wing328 modified the milestones: 3.2.1, 3.2.2 Aug 14, 2018
@jmini
Copy link
Member

jmini commented Aug 17, 2018

Tested with:

openapi: 3.0.1
info:
  title: test issue 405
  version: '1.0'
servers:
  - url: 'http://localhost:8000/'
paths:
  /ping:
    get:
      operationId: pingGet
      responses:
        '201':
          description: OK
    put:
      operationId: pingPut
      requestBody:
        required: true
        content:
         'multipart/form-data':
            schema:
                    $ref: '#/components/schemas/SomeFormObj'
      responses:
        '201':
          description: OK
components:
  schemas:
    SomeFormObj:
      type: object
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
    SomeObj:
      type: object
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string

@wing328 wing328 merged commit 0f30a05 into master Aug 17, 2018
@wing328 wing328 deleted the generate_all_model branch August 17, 2018 11:01
@wing328 wing328 mentioned this pull request Aug 17, 2018
A-Joshi pushed a commit to ihsmarkitoss/openapi-generator that referenced this pull request Feb 27, 2019
* add option to generate all models

* update doc

* rename option to skipFormModel

* update petstore samples

* Update doc

* Update samples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[JAVA] Generating code is referencing a generated model class which is not created
3 participants