Пример #1
0
        private ChangedOpenApiBO Compare()
        {
            PreProcess(OldSpecOpenApi);
            PreProcess(NewSpecOpenApi);
            var paths =
                PathsDiff.Diff(PathsDiff.ValOrEmpty(OldSpecOpenApi.Paths), PathsDiff.ValOrEmpty(NewSpecOpenApi.Paths));

            NewEndpoints      = new List <EndpointBO>();
            MissingEndpoints  = new List <EndpointBO>();
            ChangedOperations = new List <ChangedOperationBO>();

            if (paths != null)
            {
                NewEndpoints     = EndpointUtils.ConvertToEndpointList <EndpointBO>(paths.Increased);
                MissingEndpoints = EndpointUtils.ConvertToEndpointList <EndpointBO>(paths.Missing);
                foreach (var(key, value) in paths.Changed)
                {
                    NewEndpoints.AddRange(EndpointUtils.ConvertToEndpoints <EndpointBO>(key, value.Increased));
                    MissingEndpoints.AddRange(EndpointUtils.ConvertToEndpoints <EndpointBO>(key, value.Missing));
                    ChangedOperations.AddRange(value.Changed);
                }
            }

            var diff = ExtensionsDiff
                       .Diff(OldSpecOpenApi.Extensions, NewSpecOpenApi.Extensions);

            if (diff != null)
            {
                ChangedExtensions = diff;
            }
            return(GetChangedOpenApi());
        }
Пример #2
0
 private void InitializeFields(IEnumerable <IExtensionDiff> extensions)
 {
     PathsDiff                = new PathsDiff(this);
     PathDiff                 = new PathDiff(this);
     SchemaDiff               = new SchemaDiff(this);
     ContentDiff              = new ContentDiff(this);
     ParametersDiff           = new ParametersDiff(this);
     ParameterDiff            = new ParameterDiff(this);
     RequestBodyDiff          = new RequestBodyDiff(this);
     ResponseDiff             = new ResponseDiff(this);
     HeadersDiff              = new HeadersDiff(this);
     HeaderDiff               = new HeaderDiff(this);
     APIResponseDiff          = new ApiResponseDiff(this);
     OperationDiff            = new OperationDiff(this);
     SecurityRequirementsDiff = new SecurityRequirementsDiff(this);
     SecurityRequirementDiff  = new SecurityRequirementDiff(this);
     SecuritySchemeDiff       = new SecuritySchemeDiff(this);
     OAuthFlowsDiff           = new OAuthFlowsDiff(this);
     OAuthFlowDiff            = new OAuthFlowDiff(this);
     ExtensionsDiff           = new ExtensionsDiff(this, extensions);
     MetadataDiff             = new MetadataDiff(this);
 }