Fix NullPointerException in HtmlRender when schema is null

Merged
CO
1y ago
+75-7
  • Analyze the issue - NullPointerException in HtmlRender.div_changedSchema when schema is null
  • Create test case to reproduce the issue
  • Implement fix in HtmlRender.java to handle null schema
  • Run tests to verify the fix
  • Run code review
  • Rename test methods and YAML files to include issue ID #865
Original prompt

This section details on the original issue you should resolve

<issue_title>BUG: An unhandled exception after printing the result</issue_title>
<issue_description>
After printing results I receive this error:

`--------------------------------------------------------------------------
-- Result --

               API changes are backward compatible                    

Unexpected exception. Reason: Cannot invoke "org.openapitools.openapidiff.core.model.ChangedSchema.isIncompatible()" because "schema" is null
java.lang.NullPointerException: Cannot invoke "org.openapitools.openapidiff.core.model.ChangedSchema.isIncompatible()" because "schema" is null
at org.openapitools.openapidiff.core.output.HtmlRender.div_changedSchema(HtmlRender.java:358)
at org.openapitools.openapidiff.core.output.HtmlRender.li_changedRequest(HtmlRender.java:346)
at org.openapitools.openapidiff.core.output.HtmlRender.ul_request(HtmlRender.java:330)
at org.openapitools.openapidiff.core.output.HtmlRender.ol_changed(HtmlRender.java:212)
at org.openapitools.openapidiff.core.output.HtmlRender.render(HtmlRender.java:106)
at org.openapitools.openapidiff.cli.Main.main(Main.java:245)
⚠️ API changes broke backward compatibility`</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.