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 isCircularReference to properties #4553

Merged
merged 1 commit into from
Dec 10, 2019

Conversation

eriktim
Copy link
Contributor

@eriktim eriktim commented Nov 20, 2019

As a preparation to a major refactoring of the Elm generator I would like to add the ability of detecting circular references. Support for self referring types was already in place, but this PR also detects types that indirectly refer back to themselves. Every property that indirectly refers back to itself gets marked with isCircularReference.

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.

cc @wing328 @jimschubert @cbornet @ackintosh @jmini @etherealjoy

@@ -347,6 +347,7 @@ public int compare(CodegenModel cm1, CodegenModel cm2) {
});
}
}
setCircularReferences(allModels);
Copy link
Member

Choose a reason for hiding this comment

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

Can we add this to the default codegen instead as users would expect isCircularReference with a valid value (true, false) for all generators?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wing328 that was my intention, that's why I added it to updateAllModels in DefaultCodegen. Somehow this did got not triggered in Elm, so I thought I'd probably overridden it. Is updateAllModels the correct place to put this?

Copy link
Member

Choose a reason for hiding this comment

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

Can you please move it to updateAllModels and I'll run some tests later to troubleshoot?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wing328 I already put it in updateAllModels. Do I need to remove it from the Elm codegen?

@wing328 wing328 merged commit a695748 into OpenAPITools:master Dec 10, 2019
@eriktim eriktim deleted the circular-references branch December 10, 2019 15:00
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.

2 participants