Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indicate "before/after" in error JSON #676

Open
mikeharder opened this issue Apr 5, 2024 · 2 comments
Open

Indicate "before/after" in error JSON #676

mikeharder opened this issue Apr 5, 2024 · 2 comments
Assignees

Comments

@mikeharder
Copy link
Member

Errors should include one or more ways to indicate whether they apply to the "before" or "after" spec. Example of current schema:

{
  "pluginName": "spectral",
  "extensionName": "@microsoft.azure/openapi-validator",
  "level": "error",
  "message": "The integer type does not have a format, please add it.",
  "code": "IntegerTypeMustHaveFormat",
  "details": {
    "jsonpath": ["definitions", "TasksState", "properties", "tasks", "properties", "completed" ],
    "validationCategory": "ARMViolation",
    "providerNamespace": false,
    "resourceType": false,
    "range": {"start": { "line": 2251, "column": 26 }, "end": { "line": 2253, "column": 14} } },
    "source": [ {"document": "file:///mnt/vss/_work/1/lint-c93b354fd9c14905bb574a8834c4d69b/specification/cognitiveservices/data-plane/Language/stable/2022-05-01/analyzetext.json", 
    "position": {"line": 2251, "column": 13}
    }
  ]
}

Options:

  • Add property beforeOrAfter with values before and after
  • Change "before" path to include directory /before/, and "after" path to include directory /after/
@mikeharder mikeharder self-assigned this Apr 5, 2024
@konrad-jamrozik
Copy link
Member

I understand that before this change goes in we can use this heuristic:

  • It is before if the path is of form vss/_work/1/lint-asd77d8as/specifcation - this means "target branch of PR
  • It is after if the path is of form vss/_work/1/azure-rest-api-specs - this means "changes in PR"

@konrad-jamrozik
Copy link
Member

konrad-jamrozik commented Apr 5, 2024

Add property beforeOrAfter with values before and after

I significantly prefer this approach instead of tampering with the path. I understand by path you mean details.source.document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants