Skip to content

Potential type mis-match between type definitions and examples. #28

@ferrywlto

Description

@ferrywlto

Problem

In the schema definition excerpt below, it could only be an integer or FeatureBreakdown:

"consumedService": {
  "additionalProperties": {
    "oneOf": [
      {
        "$ref": "#/components/schemas/LicenseReport.FeatureBreakdown"
      },
      {
        "type": "integer",
        "format": "int32"
      }
    ]
  },
  "description": "Usage telemetry retrieved for the service to indicate if the specific principal is consuming the service or not, regardless of license status.",
  "type": "object"
}

Taking a portion of LicenseReport.LicenseData examples:

"consumedService": {
  "eec0eb4f-6444-4f95-aba0-50c24d67f998": {
    "Conditional Access": true,
    "Access Review": false,
    "Entitlement Management": false,
    "Identity Protection": true
  },
  "41781fb2-bc02-4b7c-bd55-b576c07bb09d": {
    "Conditional Access": true,
    "Dynamic Group": false,
    "Group Naming": true,
    "On-Prem SSPR": false,
    "Group Expiration": true,
    "Provisioning Engine": true,
    "Enterprise State Roaming": false
  },
  "4b0d28f2-c1ce-48ae-a7d2-1caaa7825891": null,
  "c90f1a25-e6cd-4163-ac6c-ca7616c585a9": null
}

However we can see that the value of a key can either be null or FeatureBreakdown. Throughout the whole specification file, all examples are setting the value of the keys to null if not a FeatureBreakdown object. This does not match the type definition.

Question

Are the examples or the type definitions the source of truth?

Suggestion

If the examples are the source of truth, we should update the type definition as below instead of using integer:

"consumedService": {
  "additionalProperties": {
    "oneOf": [
      { "$ref": "#/components/schemas/LicenseReport.FeatureBreakdown" },
      { "type": "null" }
    ]
  },
  "description": "Usage telemetry retrieved for the service ...",
  "type": "object"
}

Or if the type definitions are correct, we should update all examples to integer instead of null to avoid confusions.

"consumedService": {
  "eec0eb4f-6444-4f95-aba0-50c24d67f998": {
    "Conditional Access": true,
    "Access Review": false,
    "Entitlement Management": false,
    "Identity Protection": true
  },
  "41781fb2-bc02-4b7c-bd55-b576c07bb09d": {
    "Conditional Access": true,
    "Dynamic Group": false,
    "Group Naming": true,
    "On-Prem SSPR": false,
    "Group Expiration": true,
    "Provisioning Engine": true,
    "Enterprise State Roaming": false
  },
  "4b0d28f2-c1ce-48ae-a7d2-1caaa7825891": 0,
  "c90f1a25-e6cd-4163-ac6c-ca7616c585a9": 0
}

@elliot-huffman @pasha-zayko May you confirm about it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions