Skip to content

Fix invalid JSON Schema in listing_config_schema.json - #191

Open
Manya Sharma (ManyaS-Git) wants to merge 1 commit into
microsoft:masterfrom
ManyaS-Git:fix/listing-config-schema
Open

Fix invalid JSON Schema in listing_config_schema.json#191
Manya Sharma (ManyaS-Git) wants to merge 1 commit into
microsoft:masterfrom
ManyaS-Git:fix/listing-config-schema

Conversation

@ManyaS-Git

Copy link
Copy Markdown

Summary

.ci/listing_config_schema.json declares $schema: https://json-schema.org/draft/2020-12/schema, but it was not valid against that meta-schema. Validating with the jsonschema library surfaced 21 meta-schema violations, from two distinct problems:

1. "type": "list" is not a valid JSON Schema type (offer_listing)

The listing_contacts, listing_uris, listing_logos, listing_screenshots and listing_videos fields used "type": "list". list is not a valid JSON Schema type — these are collections, so the correct type is "array".

2. plan_overview was structurally malformed

  • items.properties contained a nested {"type": "array", "items": {...}} wrapper that held the actual plan object, so the property names type/items were treated as schema properties and the real plan properties were never applied.
  • A duplicate copy of the plan schema was also placed at the array level under a properties keyword, which is meaningless on an array schema and was silently ignored.

The real plan properties (plan_listing, pricing_and_availability, technical_configuration) are now declared directly under items.properties, and the duplicated array-level block is removed.

Verification (with the jsonschema library, draft 2020-12)

Check Before After
Valid against declared meta-schema INVALID (21 violations) VALID (0 violations)
Accepts a realistic configuration instance
Rejects malformed plan data (e.g. plan_listing: 123) silently accepted ✓ rejected

This means the schema now actually constrains the plan data it was meant to describe instead of accepting anything.

The schema declares \ draft/2020-12 but was not valid against that meta-schema (21 violations):

- offer_listing fields used the non-existent type 'list'; these are lists of
  contacts, URIs, logos, screenshots and videos, so the correct type is 'array'.
- plan_overview was malformed: items.properties contained a nested
  {'type': 'array', 'items': {...}} wrapper holding the real plan object, and a
  duplicate copy was also placed at the array level under a meaningless
  'properties' keyword. The real plan properties (plan_listing,
  pricing_and_availability, technical_configuration) are now declared directly
  under items.properties, and the duplicated array-level block is removed.

Verified with the jsonschema validator:
- The old schema was INVALID per its declared meta-schema and silently accepted
  malformed plan data (e.g. plan_listing: 123).
- The fixed schema passes check_schema (0 violations), validates a realistic
  configuration instance, and correctly rejects invalid plan data.
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