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 referenced in oneOf in path is ignored #31

Closed
remkoboschker opened this issue Jul 29, 2019 · 7 comments
Closed

model referenced in oneOf in path is ignored #31

remkoboschker opened this issue Jul 29, 2019 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@remkoboschker
Copy link

remkoboschker commented Jul 29, 2019

The model referenced in the path below is being ignored. It is referenced correctly in the service definition. But the model itself is not generated. I'm using 0.5.2

 "/api/v1/Rollen": {
            "get": {
                "tags": ["Rollen"],
                "operationId": "ApiV1RollenGet",
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "nullable": true,
                                    "oneOf": [
                                        {
                                            "$ref": "#/components/schemas/RolIndexResult"
                                        }
                                    ]
                                }
                            }
                        }
                    }
                }
            }
        },
@remkoboschker
Copy link
Author

As far as I understand the issue is that an import should be added the service. Will work on a PR

@luisfpg
Copy link
Contributor

luisfpg commented Jul 29, 2019

The fix I did for #28 works for other models that reference models in oneOf, not for inline objects in services...
If you'll work on a PR, here's a tip: ng-openapi-gen.ts collects both service.imports and service.additionalDependencies. Somehow the Service constructor in service.ts should call collectImports(<something>, true) for the oneOf references.

remkoboschker added a commit to remkoboschker/ng-openapi-gen that referenced this issue Jul 30, 2019
remkoboschker added a commit to remkoboschker/ng-openapi-gen that referenced this issue Jul 30, 2019
remkoboschker added a commit to remkoboschker/ng-openapi-gen that referenced this issue Jul 30, 2019
luisfpg added a commit that referenced this issue Aug 8, 2019
@luisfpg
Copy link
Contributor

luisfpg commented Aug 8, 2019

@remkoboschker I pushed a fix to the one-of-path branch.
Can you, please, test it?

@remkoboschker
Copy link
Author

@luisfpg good morning, I tested your one-of-path branch with our swagger file. I found two issues: I get a compile error missing : here https://github.com/cyclosproject/ng-openapi-gen/blob/master/templates/requestBuilder.handlebars#L168 and the nullable-one-of patter

  "avatar": {
                        "nullable": true,
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/AvatarDto"
                            }
                        ]
                    },

also occures in components with a nullable reference. These are not imported at the moment. The component model shows a avatar?: null | AvatarDto;, but the AvatarDto is not imported.

@luisfpg
Copy link
Contributor

luisfpg commented Aug 9, 2019

@remkoboschker Thanks for the feedback.
I've pushed a fix. Can you, please, try it again?

@luisfpg luisfpg added the bug Something isn't working label Aug 9, 2019
@luisfpg luisfpg self-assigned this Aug 9, 2019
@remkoboschker
Copy link
Author

remkoboschker commented Aug 9, 2019 via email

@remkoboschker
Copy link
Author

Thank you, all previouw issues seems to have been solved, but I found a new one. When a path has a verb with parameters with a schema with nullable and oneOf, the oneOf type is not imported in de service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants