コード例 #1
0
        public ApiDefinitionParseResult Read(string document, Uri?swaggerUri)
        {
            foreach (IApiDefinitionReader reader in _readers)
            {
                ApiDefinitionParseResult parseResult = reader.CanHandle(document);
                if (parseResult.Success)
                {
                    ApiDefinitionParseResult result = reader.ReadDefinition(document, swaggerUri);

                    return(result);
                }
            }

            return(ApiDefinitionParseResult.Failed);
        }
コード例 #2
0
        public ApiDefinitionParseResult CanHandle(string document)
        {
            if (document is null)
            {
                return(ApiDefinitionParseResult.Failed);
            }

            foreach (IApiDefinitionReader reader in _readers)
            {
                ApiDefinitionParseResult result = reader.CanHandle(document);
                if (result.Success)
                {
                    return(result);
                }
            }
            return(ApiDefinitionParseResult.Failed);
        }