public string GetValidationMessagesAsJson()

in openapi-diff/src/modeler/AutoRest.Swagger/ComparisonMessage.cs [117:146]


        public string GetValidationMessagesAsJson()
        {
            var rawMessage = new JsonComparisonMessage
            {
                id = Id.ToString(),
                code = Code.ToString(),
                message = Message,
                type = Severity.ToString(),
                docUrl = DocUrl.ToString(),
                mode = Mode.ToString(),
                old = new JsonLocation
                {
                    @ref = OldJsonRef,
                    path = OldJson()?.Path,
                    location = OldLocation(),
                },
                @new = new JsonLocation
                {
                    @ref = NewJsonRef,
                    path = NewJson()?.Path,
                    location = NewLocation(),
                }
            };

            return JsonConvert.SerializeObject(
                rawMessage, 
                Formatting.Indented,
                new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }
            );
        }