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

[BUG] [HTML2] oneOf in response generates empty response schema in html #13313

Closed
5 of 6 tasks
pbarnes-tibco opened this issue Aug 30, 2022 · 1 comment · Fixed by #18642
Closed
5 of 6 tasks

[BUG] [HTML2] oneOf in response generates empty response schema in html #13313

pbarnes-tibco opened this issue Aug 30, 2022 · 1 comment · Fixed by #18642

Comments

@pbarnes-tibco
Copy link

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

A response or a request body with oneOf generates empty response schema, and mostly empty/incomplete body parameters schema with the html2 generator.

openapi-generator version

Using 5.4.0. Also reproduced in 6.0.0 and master. 6.0.1 has an additional problem with a JavaScript syntax error, which appears to have been fixed in master already, so wasn't able to test there.

OpenAPI declaration file content or url

minimal spec to repro it here: https://gist.github.com/pbarnes-tibco/fc6320658db878262a1adc3696ea06ec

Generation Details

use the above linked openapi.yaml and run as:
openapi-generator-cli generate -g html2 -i openapi.yaml -o generated

Steps to reproduce

Generate the html doc with the above. Open in e.g. chrome and notice that the getPets response schema is empty, and the createPet body parameter section has no detail. There are errors in the dev tools console like

index.html:11 Uncaught TypeError: Cannot read properties of null (reading 'appendChild')
    at index.js:16:36
    at Array.forEach (<anonymous>)
    at JSONSchemaView.appendXOf (index.js:16:36)
    at JSONSchemaView.appendChildren (index.js:366:4)
    at JSONSchemaView.render (index.js:320:10)
    at HTMLDocument.<anonymous> (index.html:1233:22)
    at j (index.html:11:29568)
    at k (index.html:11:29882)
Related issues/PRs
Suggest a fix

oneOf should be allowed in response or body parameter. For us, especially in the response. We have a number of operations which can return one of a number of classes deriving from a common base model, as seen in this example.

@wing328
Copy link
Member

wing328 commented Aug 31, 2022

@pbarnes-tibco thanks for reporting the issue. I don't think it supports oneOf, anyOf yet. We welcome PRs to enhance that.

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

Successfully merging a pull request may close this issue.

2 participants