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

[model generator] Get rid of the AllOf classes #17

Closed
lburgazzoli opened this issue Apr 7, 2021 · 2 comments
Closed

[model generator] Get rid of the AllOf classes #17

lburgazzoli opened this issue Apr 7, 2021 · 2 comments
Assignees
Labels

Comments

@lburgazzoli
Copy link
Contributor

The ConnectorDeployment metadata is defined as ConnectorDeploymentAllOfMetadata where tha "AllOf" adds nothing:

public class ConnectorDeployment {
  public static final String JSON_PROPERTY_METADATA = "metadata";
  private ConnectorDeploymentAllOfMetadata metadata;

We should investigate if simpler names are possible, like ConnectorDeploymentMetadata

@dhirajsb dhirajsb self-assigned this Apr 8, 2021
@dhirajsb
Copy link
Contributor

@lburgazzoli I looked into this in detail. The AllOf classname generation is baked into the Java code that create type names. So, overriding it would require writing a new custom generator written in Java, perhaps inheriting the existing Java generator.

It turns out there is also an open issue in the generator for why these classes are generated. There is a workaround that requires modifying our openapi definitions to move properties from out of allOf and into the root of the outer object, e.g.:

     ConnectorTypeList:
       allOf:
         - $ref: '#/components/schemas/List'
-        - type: object
-          properties:
-            items:
-              type: array
-              items:
-                allOf:
-                  - $ref: '#/components/schemas/ConnectorType'
+      type: object
+      properties:
+        items:
+          type: array
+          items:
+            allOf:
+              - $ref: '#/components/schemas/ConnectorType'
+

But, the original definition seems to be the way the openapi spec suggests property inheritance should be done. So, I'm not sure whether we should be deviating from the spec and change our model definitions or live with the genreated AllOf class names.

@lburgazzoli
Copy link
Contributor Author

thx for the investigation, let's keep them then

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

No branches or pull requests

2 participants