[Git][ghc/ghc][wip/sol/latest-json-schema] Rename `diagnostics-as-json-schema-1_1.json` to `-latest.json`

Simon Hengel pushed to branch wip/sol/latest-json-schema at Glasgow Haskell Compiler / GHC Commits: 4e2167d8 by Simon Hengel at 2025-07-09T13:47:58+07:00 Rename `diagnostics-as-json-schema-1_1.json` to `-latest.json` - - - - - 3 changed files: - compiler/GHC/Types/Error.hs - docs/users_guide/diagnostics-as-json-schema-1_1.json - + docs/users_guide/diagnostics-as-json-schema-latest.json Changes: ===================================== compiler/GHC/Types/Error.hs ===================================== @@ -573,16 +573,32 @@ instance ToJson DiagnosticCode where {- Note [Diagnostic Message JSON Schema] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The below instance of ToJson must conform to the JSON schema -specified in docs/users_guide/diagnostics-as-json-schema-1_1.json. +specified in docs/users_guide/diagnostics-as-json-schema-latest.json. When the schema is altered, please bump the version. If the content is altered in a backwards compatible way, update the minor version (e.g. 1.3 ~> 1.4). If the content is breaking, update the major version (e.g. 1.3 ~> 2.0). -When updating the schema, replace the above file and name it appropriately with -the version appended, and change the documentation of the -fdiagnostics-as-json -flag to reflect the new schema. -To learn more about JSON schemas, check out the below link: -https://json-schema.org + +To update to the next minor version: + +1. Update `schemaVersion`: + + schemaVersion = "1.2" + +2. Create a symlink for the new schema version: + + cp --remove-destination docs/users_guide/diagnostics-as-json-schema-latest.json docs/users_guide/diagnostics-as-json-schema-1_1.json + ln -s diagnostics-as-json-schema-latest.json docs/users_guide/diagnostics-as-json-schema-1_2.json + git add docs/users_guide/diagnostics-as-json-schema-* + +3. Update the schema path in the User's Guide: + + sed -i s/schema-1_1/schema-1_2/ docs/users_guide/using.rst + +4. Add your schema changes to `docs/users_guide/diagnostics-as-json-schema-latest.json`. + +5. Update this instructions. + -} schemaVersion :: String ===================================== docs/users_guide/diagnostics-as-json-schema-1_1.json deleted ===================================== @@ -1,137 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "JSON Diagnostic Schema", - "description": "A Schema for specifying GHC diagnostics output as JSON", - "type": "object", - "properties": { - "version": { - "description": "The current JSON schema version this object conforms to", - "type": "string" - }, - "ghcVersion": { - "description": "The GHC version", - "type": "string" - }, - "span": { - "oneOf": [ - { "$ref": "#/$defs/span" }, - { "type": "null" } - ] - }, - "severity": { - "description": "The diagnostic severity", - "type": "string", - "enum": [ - "Warning", - "Error" - ] - }, - "code": { - "description": "The diagnostic code (if it exists)", - "type": [ - "integer", - "null" - ] - }, - "message": { - "description": "The string output of the diagnostic message by GHC", - "type": "array", - "items": { - "type": "string" - } - }, - "hints": { - "description": "The suggested fixes", - "type": "array", - "items": { - "type": "string" - } - }, - "reason" : { - "description": "The GHC flag that was responsible for the emission of the diagnostic message", - "oneOf": [ - { - "type": "object", - "description": "The diagnostic message was controlled by one or more GHC flags", - "properties": { - "flags": { - "type": "array", - "items": { - "description": "The name of a GHC flag controlling the diagnostic message", - "type": "string" - }, - "minItems": 1 - } - }, - "required": ["flags"] - }, - { - "type": "object", - "description": "The diagnostic message was controlled by a GHC diagnostic message category", - "properties": { - "category": { - "description": "The name of the GHC diagnostic message category controlling the diagnostic message", - "type": "string" - } - }, - "required": ["category"] - } - ] - } - }, - "required": [ - "version", - "ghcVersion", - "span", - "severity", - "code", - "message", - "hints" - ], - "additionalProperties": false, - "$defs": { - "span": { - "description": "The span of the diagnostic", - "type": "object", - "properties": { - "file": { - "description": "The file in which the diagnostic occurs", - "type": "string" - }, - "start": { - "description": "The start location of the diagnostic", - "$ref": "#/$defs/location" - }, - "end": { - "description": "The end location of the diagnostic", - "$ref": "#/$defs/location" - } - }, - "required": [ - "file", - "start", - "end" - ], - "additionalProperties": false - }, - "location": { - "description": "A location in a text file", - "type": "object", - "properties": { - "line": { - "description": "The line number", - "type": "integer" - }, - "column": { - "description": "The column number", - "type": "integer" - } - }, - "required": [ - "line", - "column" - ], - "additionalProperties": false - } - } -} ===================================== docs/users_guide/diagnostics-as-json-schema-1_1.json ===================================== @@ -0,0 +1 @@ +diagnostics-as-json-schema-latest.json \ No newline at end of file ===================================== docs/users_guide/diagnostics-as-json-schema-latest.json ===================================== @@ -0,0 +1,137 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "JSON Diagnostic Schema", + "description": "A Schema for specifying GHC diagnostics output as JSON", + "type": "object", + "properties": { + "version": { + "description": "The current JSON schema version this object conforms to", + "type": "string" + }, + "ghcVersion": { + "description": "The GHC version", + "type": "string" + }, + "span": { + "oneOf": [ + { "$ref": "#/$defs/span" }, + { "type": "null" } + ] + }, + "severity": { + "description": "The diagnostic severity", + "type": "string", + "enum": [ + "Warning", + "Error" + ] + }, + "code": { + "description": "The diagnostic code (if it exists)", + "type": [ + "integer", + "null" + ] + }, + "message": { + "description": "The string output of the diagnostic message by GHC", + "type": "array", + "items": { + "type": "string" + } + }, + "hints": { + "description": "The suggested fixes", + "type": "array", + "items": { + "type": "string" + } + }, + "reason" : { + "description": "The GHC flag that was responsible for the emission of the diagnostic message", + "oneOf": [ + { + "type": "object", + "description": "The diagnostic message was controlled by one or more GHC flags", + "properties": { + "flags": { + "type": "array", + "items": { + "description": "The name of a GHC flag controlling the diagnostic message", + "type": "string" + }, + "minItems": 1 + } + }, + "required": ["flags"] + }, + { + "type": "object", + "description": "The diagnostic message was controlled by a GHC diagnostic message category", + "properties": { + "category": { + "description": "The name of the GHC diagnostic message category controlling the diagnostic message", + "type": "string" + } + }, + "required": ["category"] + } + ] + } + }, + "required": [ + "version", + "ghcVersion", + "span", + "severity", + "code", + "message", + "hints" + ], + "additionalProperties": false, + "$defs": { + "span": { + "description": "The span of the diagnostic", + "type": "object", + "properties": { + "file": { + "description": "The file in which the diagnostic occurs", + "type": "string" + }, + "start": { + "description": "The start location of the diagnostic", + "$ref": "#/$defs/location" + }, + "end": { + "description": "The end location of the diagnostic", + "$ref": "#/$defs/location" + } + }, + "required": [ + "file", + "start", + "end" + ], + "additionalProperties": false + }, + "location": { + "description": "A location in a text file", + "type": "object", + "properties": { + "line": { + "description": "The line number", + "type": "integer" + }, + "column": { + "description": "The column number", + "type": "integer" + } + }, + "required": [ + "line", + "column" + ], + "additionalProperties": false + } + } +} View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4e2167d8ea9c8fe417505e844139ccd6... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4e2167d8ea9c8fe417505e844139ccd6... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Hengel (@sol)