private Operation CreateGetByIdOperation(SwaggerPathsResource swaggerResource) { return(new Operation { tags = new List <string> { SwaggerDocumentHelper.GetResourcePluralName(swaggerResource.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{swaggerResource.Resource.PluralName}ById", deprecated = swaggerResource.IsDeprecated, produces = new[] { _contentTypeStrategy.GetOperationContentType(swaggerResource, ContentTypeUsage.Readable) }, parameters = new[] { // Path parameters need to be inline in the operation, and not referenced. SwaggerDocumentHelper.CreateIdParameter(), new Parameter { @ref = SwaggerDocumentHelper.GetParameterReference("If-None-Match") } }.Concat( swaggerResource.DefaultGetByIdParameters .Select(p => new Parameter { @ref = SwaggerDocumentHelper.GetParameterReference(p) })) .ToList(), responses = SwaggerDocumentHelper.GetReadOperationResponses( _pathsFactoryNamingStrategy.GetResourceName(swaggerResource, ContentTypeUsage.Readable), false) }); }
private IList <Parameter> CreatePutParameters(SwaggerPathsResource swaggerResource) { IList <Parameter> parameterList = new List <Parameter>(); parameterList.Add(SwaggerDocumentHelper.CreateIdParameter()); parameterList.Add(CreateIfMatchParameter("PUT from updating")); parameterList.Add(CreateBodyParameter(swaggerResource)); return(parameterList); }
private Operation CreateDeleteByIdOperation(SwaggerPathsResource swaggerResource) { return(new Operation { tags = new List <string> { SwaggerDocumentHelper.GetResourcePluralName(swaggerResource.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{swaggerResource.Name}ById", deprecated = swaggerResource.IsDeprecated, consumes = new[] { _contentTypeStrategy.GetOperationContentType(swaggerResource, ContentTypeUsage.Writable) }, parameters = new[] { SwaggerDocumentHelper.CreateIdParameter(), CreateIfMatchParameter("DELETE from removing") }, responses = SwaggerDocumentHelper.GetWriteOperationResponses(HttpMethod.Delete) }); }