Skip to content

Conversation

@AIexG
Copy link
Contributor

@AIexG AIexG commented Dec 10, 2019

Added a member circularReferences to CodegenModel which stores all circular referenced schemas. Created ModelUtils method getCircularReferencedSchemaNames() to call recursive detectCircularReferences() to store all found circular references in a Set of strings. Set gets stored in circularReferences.

Add a member flag to CodegenProperty which is true if an array schema consists of object schema items.

PR checklist

  • Read the contribution guidelines.
  • If contributing template-only or documentation-only changes which will change sample output, build the project before.
  • Run the shell script(s) under ./bin/ (or Windows batch scripts under.\bin\windows) to update Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the code or mustache templates for a language ({LANG}) (e.g. php, ruby, python, etc).
  • File the PR against the correct branch: master, 4.3.x, 5.0.x. Default: master.
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

Related feature request

closes #4757

Additional context

First pull request(s), hopefully doing everything right!

technical committee

cc @OpenAPITools/generator-core-team

* added model utility to handle circular dependencies (e.g. for forward declaration)
* added property isModelContainer if a container contains more models
@AIexG AIexG changed the title Added members for circular refs and container of models [Core] Added members for circular refs and container of models Dec 10, 2019
@AIexG
Copy link
Contributor Author

AIexG commented Dec 10, 2019

I noticed that #4553 just got merged, which adds a similar functionality for a different purpose.

@wing328
Copy link
Member

wing328 commented Dec 26, 2019

When you've time, can you please add some tests similar to those added in #4553 ?

@AIexG
Copy link
Contributor Author

AIexG commented Jan 2, 2020

Will do when I got some time on my hands again!

@AIexG
Copy link
Contributor Author

AIexG commented Jan 22, 2020

Added some simple test cases, should hopefully be enough!

public boolean isFile;
public boolean isBoolean;
public boolean isDate; // full-date notation as defined by RFC 3339, section 5.6, for example, 2017-07-21
public boolean isDateTime; // the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
Copy link
Contributor Author

@AIexG AIexG Feb 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've noticed multiple times now that this list continuously causes conflicts when only separated by spaces. Changing it to line breaks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REQ] detect circular refs in models / detect if container contains models

2 participants