Skip to content

One of support for lagom #6964

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

fokot
Copy link
Contributor

@fokot fokot commented Jul 16, 2020

Hi @clasnake (2017/07), @jimschubert (2017/09) , @shijinkui (2018/01), @ramzimaalej (2018/03), @chameleon82 (2020/03), @Bouillie (2020/04)

  • This adds oneOf support for Lagom. I can not use sealed trait and Format derivation as generator generates every class to separate file.
  • And it support only one way of writing this in openapi - that is you need to have type which as oneOf attribute not just a property.
  • Files in /generated folder are what will be generated from oneoOfDiscriminatorSimple.yaml. I will remove them they are here so just you can tell what you think bout that without running it.

What do you think? Merging it would help our team. Thanks

PR checklist

  • [ x ] Read the contribution guidelines.
  • [ x ] If contributing template-only or documentation-only changes which will change sample output, build the project beforehand.
  • [ x ] Run the shell script ./bin/generate-samples.shto update all Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/config/java*. For Windows users, please run the script in Git BASH.
  • [ x ] File the PR against the correct branch: master
  • [ x ] Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

@wing328
Copy link
Member

wing328 commented Jul 29, 2020

@@ -0,0 +1,24 @@
/**
Copy link
Member

Choose a reason for hiding this comment

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

These outputs under generated/ should be deleted

@@ -163,6 +164,42 @@ public String toOperationId(String operationId) {
return camelize(operationId, true);
}

private CodegenModel codegenModel(Object o) {
Copy link
Member

Choose a reason for hiding this comment

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

This helper function may be confusing. It's extracting the top-level model from our object model but reads as if it intends to extract a model from any input object.

Renaming to extractTopLevelModel might make it clearer.

{{#discriminator}}
private val discriminator = "{{discriminator.propertyBaseName}}"

implicit val format: OFormat[{{classname}}] = new OFormat[Fruit]{
Copy link
Member

Choose a reason for hiding this comment

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

Fruit should not exist here…

@jimschubert
Copy link
Member

This can't be merged until the Fruit reference in template is changed appropriately.

@wing328 has your question been addressed via Slack? If you have a blocker, can you label the PR as WIP?

@wing328
Copy link
Member

wing328 commented Aug 2, 2020

@jimschubert I simply showed the oneOf implementation we'd in Java (jersey2) as a reference.

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.

3 participants