Skip to content

Guard comparison against null path, parameter, and schema collections - #105

Open
Jerry-Johnson-3 wants to merge 1 commit into
criteo:mainfrom
Jerry-Johnson-3:fix/null-collection-nre
Open

Jerry-Johnson-3 wants to merge 1 commit into
criteo:mainfrom
Jerry-Johnson-3:fix/null-collection-nre

Conversation

@Jerry-Johnson-3

@Jerry-Johnson-3 Jerry-Johnson-3 commented Aug 24, 2026

Copy link
Copy Markdown

Summary

  • Treat missing path parameters, operation maps, and component schemas as empty dictionaries/lists so document comparison does not throw.
  • Coalesce null operation parameters lists and resolve $ref parameters with Components?.Parameters.
  • Add focused unit tests that mutate parsed documents to the null collection states OpenAPI.NET can leave in memory.

Spec

OpenAPI 3.0 treats unspecified fields as optional. A path item may have no operations or parameters; components and its maps may be omitted. $ref resolution must tolerate a missing components.parameters map.

Testing

  • Red: the five new tests failed with NullReferenceException / ArgumentNullException in CompareParameters, CompareOperations, CompareSchemas, and ParameterComparator.Compare.
  • Green: the same tests passed after the null coalescing, and the full 0.8.3 suite stayed green (101 tests).

Treat missing OpenAPI collections as empty so comparing documents, operations, and parameter $refs does not throw.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant