Skip to content

fix: Fix Swagger UI rendering of CVSS4 nested schema fields#273

Open
mtruj013 wants to merge 2 commits into
mainfrom
csv4-docs
Open

fix: Fix Swagger UI rendering of CVSS4 nested schema fields#273
mtruj013 wants to merge 2 commits into
mainfrom
csv4-docs

Conversation

@mtruj013

@mtruj013 mtruj013 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Done

  • Fixed cvs4 fields not showing up on swagger docs

QA

Issue / Card

Fixes https://warthogs.atlassian.net/browse/WD-37123

Screenshots

Screenshot 2026-06-11 at 15 19 17

@Skazitron

Skazitron commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

@mtruj013 Thanks for the fix. Is there a way to achieve the same outcome without making those CVSS4 fields mandatory?

@mtruj013

Copy link
Copy Markdown
Contributor Author

@Skazitron removing allow_none=true doesn't make the fields mandatory, that's done with the required parameter. allow_none only controls whether an explicit null is valid, it defaults to false, meaning null would now be rejected if passed. I confirmed with the sec team that they do not pass these as null but rather just omit them so this parameter is not needed

@Skazitron

Copy link
Copy Markdown
Contributor

@mtruj013 got it. LGTM then.

@mtruj013

Copy link
Copy Markdown
Contributor Author

Dealing with really long/hanging jenkins builds. Fixing that before merging this as it is not super high priority

Copilot AI review requested due to automatic review settings July 2, 2026 17:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the Marshmallow schema definitions for CVSS v4 objects so that Swagger UI correctly renders nested schema fields in the generated OpenAPI/Swagger documentation for the Security API.

Changes:

  • Removed allow_none=True from several CVSS v4 Nested(...) fields to improve Swagger UI rendering of nested properties.
  • Updated CVSS v4 base/modified/environmental/threat metric schema nesting to be non-nullable in the spec.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread webapp/schemas.py
Comment on lines +598 to +601
baseMetrics = Nested(CvssV4BaseMetrics)
supplementalMetrics = Nested(CvssV4SupplementalMetrics)
environmentalMetrics = Nested(CvssV4EnvironmentalMetrics)
threatMetrics = Nested(CvssV4ThreatMetrics)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants