Skip to content

Conversation

@sarangan12
Copy link
Contributor

@billytrend @sergey-shandar Please review this PR. This PR is to change the output structure of the Diff Tool.

JSON Format
Old Output

{
  "id": "1001",
  "code": "NoVersionChange",
  "message": "The versions have not changed.",
  "jsonref": "#",
  "json-path": "#",
  "type": "Info"
}
{
  "id": "1006",
  "code": "RemovedDefinition",
  "message": "The new version is missing a definition that was found in the old version. Was 'DatabaseList' removed or renamed?",
  "jsonref": "#/definitions",
  "json-path": "#/definitions",
  "type": "Error"
}

Modified Output

{
  "additions": {
    "errors": [],
    "warnings": [],
    "info": []
  },
  "updates": {
    "errors": [],
    "warnings": [],
    "info": [
      {
        "message": "The versions have not changed.",
        "jsonref": "#",
        "json-path": "#",
        "id": "1001",
        "code": "NoVersionChange",
        "docurl": "https://github.com/Azure/openapi-diff/tree/master/docs/rules/1001.md"
      }
    ]
  },
  "removals": {
    "errors": [
      {
        "message": "The new version is missing a definition that was found in the old version. Was 'DatabaseList' removed or renamed?",
        "jsonref": "#/definitions",
        "json-path": "#/definitions",
        "id": "1006",
        "code": "RemovedDefinition",
        "docurl": "https://github.com/Azure/openapi-diff/tree/master/docs/rules/1006.md"
      }
    ],
    "warnings": [],
    "info": []
  }
}

String Format
Old Output

code = NoVersionChange, type = Info, message = The versions have not changed.
code = RemovedDefinition, type = Error, message = The new version is missing a definition that was found in the old version. Was 'DatabaseList' removed or renamed?

Modified Output

additions : errors = [], warnings = [], info = []; updates : errors = [], warnings = [], info = [code = NoVersionChange, message = The versions have not changed., docurl = https://github.com/Azure/openapi-diff/tree/master/docs/rules/1001.md]; removals : errors = [code = RemovedDefinition, message = The new version is missing a definition that was found in the old version. Was 'DatabaseList' removed or renamed?, docurl = https://github.com/Azure/openapi-diff/tree/master/docs/rules/1006.md], warnings = [], info = []


public override string ToString()
{
return $"errors = {GetFormattedMessageString(this.Errors)}, warnings = {GetFormattedMessageString(this.Warnings)}, info = {GetFormattedMessageString(this.Info)}";

Choose a reason for hiding this comment

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

wouldn't it be easier to just dump json here? or are you doing this for a better UX?

@sarangan12
Copy link
Contributor Author

This PR is no longer required.

@sarangan12 sarangan12 closed this Mar 4, 2019
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.

2 participants