private Operation CreateDeleteByIdOperation(OpenApiMetadataPathsResource openApiMetadataResource) { return(new Operation { tags = new List <string> { OpenApiMetadataDocumentHelper.GetResourcePluralName(openApiMetadataResource.Resource) .ToCamelCase() }, summary = "Deletes an existing resource using the resource identifier.", description = "The DELETE operation is used to delete an existing resource by identifier. If the resource doesn't exist, an error will result (the resource will not be found).", operationId = $"delete{openApiMetadataResource.Name}ById", deprecated = openApiMetadataResource.IsDeprecated, consumes = new[] { _contentTypeStrategy.GetOperationContentType(openApiMetadataResource, ContentTypeUsage.Writable) }, parameters = new[] { OpenApiMetadataDocumentHelper.CreateIdParameter(), CreateIfMatchParameter("DELETE from removing") }, responses = OpenApiMetadataDocumentHelper.GetWriteOperationResponses(HttpMethod.Delete) }); }
private IList <Parameter> CreatePutParameters(OpenApiMetadataPathsResource openApiMetadataResource) { IList <Parameter> parameterList = new List <Parameter>(); parameterList.Add(OpenApiMetadataDocumentHelper.CreateIdParameter()); parameterList.Add(CreateIfMatchParameter("PUT from updating")); parameterList.Add(CreateBodyParameter(openApiMetadataResource)); return(parameterList); }
private Operation CreateGetByIdOperation(OpenApiMetadataPathsResource openApiMetadataResource) { var parameters = new[] { // Path parameters need to be inline in the operation, and not referenced. OpenApiMetadataDocumentHelper.CreateIdParameter(), new Parameter { @ref = OpenApiMetadataDocumentHelper.GetParameterReference("If-None-Match") } }.Concat( openApiMetadataResource.DefaultGetByIdParameters .Select(p => new Parameter { @ref = OpenApiMetadataDocumentHelper.GetParameterReference(p) })) .ToList(); if (_apiSettings.IsFeatureEnabled(ApiFeature.ChangeQueries.GetConfigKeyName())) { parameters.Add(new Parameter { name = "Snapshot-Identifier", @in = "header", description = "Indicates the Snapshot-Identifier that should be used.", type = "string", required = false }); } return(new Operation { tags = new List <string> { OpenApiMetadataDocumentHelper.GetResourcePluralName(openApiMetadataResource.Resource) .ToCamelCase() }, summary = "Retrieves a specific resource using the resource's identifier (using the \"Get By Id\" pattern).", description = "This GET operation retrieves a resource by the specified resource identifier.", operationId = $"get{openApiMetadataResource.Resource.PluralName}ById", deprecated = openApiMetadataResource.IsDeprecated, produces = new[] { _contentTypeStrategy.GetOperationContentType(openApiMetadataResource, ContentTypeUsage.Readable) }, parameters = parameters, responses = CreateReadResponses(openApiMetadataResource, false) }); }
private Operation CreateDeleteByIdOperation(OpenApiMetadataPathsResource openApiMetadataResource) { var responses = OpenApiMetadataDocumentHelper.GetWriteOperationResponses(HttpMethod.Delete); if (_apiSettings.IsFeatureEnabled(ApiFeature.ChangeQueries.GetConfigKeyName())) { responses.Add( "405", new Response { description = "Method Is Not Allowed. When the Snapshot-Identifier header is present the method is not allowed." }); } return(new Operation { tags = new List <string> { OpenApiMetadataDocumentHelper.GetResourcePluralName(openApiMetadataResource.Resource) .ToCamelCase() }, summary = "Deletes an existing resource using the resource identifier.", description = "The DELETE operation is used to delete an existing resource by identifier. If the resource doesn't exist, an error will result (the resource will not be found).", operationId = $"delete{openApiMetadataResource.Name}ById", deprecated = openApiMetadataResource.IsDeprecated, consumes = new[] { _contentTypeStrategy.GetOperationContentType(openApiMetadataResource, ContentTypeUsage.Writable) }, parameters = new[] { OpenApiMetadataDocumentHelper.CreateIdParameter(), CreateIfMatchParameter("DELETE from removing") }, responses = responses }); }
private Operation CreateGetByIdOperation(OpenApiMetadataPathsResource openApiMetadataResource) { return(new Operation { tags = new List <string> { OpenApiMetadataDocumentHelper.GetResourcePluralName(openApiMetadataResource.Resource) .ToCamelCase() }, summary = "Retrieves a specific resource using the resource's identifier (using the \"Get By Id\" pattern).", description = "This GET operation retrieves a resource by the specified resource identifier.", operationId = $"get{openApiMetadataResource.Resource.PluralName}ById", deprecated = openApiMetadataResource.IsDeprecated, produces = new[] { _contentTypeStrategy.GetOperationContentType(openApiMetadataResource, ContentTypeUsage.Readable) }, parameters = new[] { // Path parameters need to be inline in the operation, and not referenced. OpenApiMetadataDocumentHelper.CreateIdParameter(), new Parameter { @ref = OpenApiMetadataDocumentHelper.GetParameterReference("If-None-Match") } }.Concat( openApiMetadataResource.DefaultGetByIdParameters .Select(p => new Parameter { @ref = OpenApiMetadataDocumentHelper.GetParameterReference(p) })) .ToList(), responses = OpenApiMetadataDocumentHelper.GetReadOperationResponses( _pathsFactoryNamingStrategy.GetResourceName(openApiMetadataResource, ContentTypeUsage.Readable), false) }); }