Skip to content

False positives when readOnly property using referenced enum #286

Open

Description

Describe the bug

I'm working on https://github.com/Azure/azure-rest-api-specs-pr/pull/15631 and there are a lot of false positives with a message of `The read only property has changed from 'true' to 'false'.

image

To Reproduce
As an example from that PR:

@doc("Subscription trial availability")
model Trial {
  @doc("Trial status")
  @visibility("read")
  status?: TrialStatus;

It does produce readOnly.

        "status": {
          "$ref": "#/definitions/TrialStatus",
          "description": "Trial status",
          "readOnly": true
        },

But before it was not a $ref, it was inline:

        "status": {
          "description": "Trial status",
          "type": "string",
          "enum": [
            "TrialAvailable",
            "TrialUsed",
            "TrialDisabled"
          ],
          "readOnly": true,
          "x-ms-enum": {
            "name": "TrialStatus",
            "modelAsString": true
          }
        },

Expected behavior
It is not marked as a breaking change.

Activity

  1. mikekistler commented on Nov 18, 2023

    @mikekistler
    Contributor

    This is a bit of a grey area since technically sibling properties of $ref should be ignored, but autorest is explicit about exceptions to this rule, and readOnly is one of the exceptions.

    https://github.com/Azure/autorest/blob/main/docs/openapi/howto/%24ref-siblings.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions