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 generated docs do not render Arrays of objects in body parameters #14246

Closed
5 of 6 tasks
egorman-verint opened this issue Dec 12, 2022 · 0 comments · Fixed by #18561
Closed
5 of 6 tasks

[BUG] HTML2 generated docs do not render Arrays of objects in body parameters #14246

egorman-verint opened this issue Dec 12, 2022 · 0 comments · Fixed by #18561

Comments

@egorman-verint
Copy link

egorman-verint commented Dec 12, 2022

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

When rendering html2 docs, an array of Objects as a body parameter is displayed as "undefined".
The browser console returns the error:
SyntaxError: Error resolving $ref pointer "http://localhost:63342/generation/test/index.html?_ijt=n7smjkttckivilrk3ohtc6e3vc&_ij_reload=RELOAD_ON_SAVE#/components/schemas/Event". (at index.html?_ijt=n7smjkttckivilrk3ohtc6e3vc&_ij_reload=RELOAD_ON_SAVE:2779:318) Token "components" does not exist.

openapi-generator version

Versions Tested:
6.3.0-Snapshot
6.2.0
5.4.0

OpenAPI declaration file content or url

https://gist.githubusercontent.com/egorman-verint/060902daebbe7262d6d30fd3dd492c41/raw/0d8c90ef846994c06ec2629a12d27fb28503e4e7/html2ArrayRender.yaml

Generation Details

docker run --rm -v c:\dev:/local openapitools/openapi-generator-cli:latest generate -i /local/api/html2ArrayRender.yaml -g html2 -o /local/generation/test

Steps to reproduce
  1. Generate docs in html2 format using the referenced yaml file
  2. View the generated docs
  3. Under Parameters, Body Parameters, observe the description of event parameter is "[ undefined ]"

Expected
Under Parameters, Body Parameters, observe the description of event parameter is "[ Event ]" with link to the event object

Related issues/PRs

#13312

Suggest a fix

The objects within the array are not being dereferenced, so the reference is returned to the view

The following can be added to modules/openapi-generator/src/main/resources/htmlDocs2/paramB.mustache for a point solution, although the dereference method should process this before it is returned.

else {
    schemaWrapper.definitions = Object.assign({}, defs);
    $RefParser.dereference(schemaWrapper).catch(function(err) {
      console.log(err);
    });
if(schema.items.$ref) {
      schema.items = defsParser.$refs.get(schema.items.$ref);
}
@egorman-verint egorman-verint changed the title [BUG] Description [BUG] HTML2 generated docs do not render Arrays of objects in body parameters Dec 12, 2022
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.

1 participant