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 Operation CreateGetOperation(SwaggerPathsResource swaggerResource) { var operation = new Operation { tags = new List <string> { SwaggerDocumentHelper.GetResourcePluralName(swaggerResource.Resource) .ToCamelCase() }, summary = "Retrieves specific resources using the resource's property values (using the \"Get\" pattern).", description = "This GET operation provides access to resources using the \"Get\" search pattern. The values of any properties of the resource that are specified will be used to return all matching results (if it exists).", operationId = swaggerResource.OperationId ?? $"get{swaggerResource.Resource.PluralName}", deprecated = swaggerResource.IsDeprecated, produces = new[] { _contentTypeStrategy.GetOperationContentType(swaggerResource, ContentTypeUsage.Readable) }, parameters = CreateGetByExampleParameters(swaggerResource), responses = SwaggerDocumentHelper.GetReadOperationResponses( _pathsFactoryNamingStrategy.GetResourceName(swaggerResource, ContentTypeUsage.Readable), true) }; return(operation); }
private Operation CreateDeletesOperation(SwaggerPathsResource swaggerResource) { return(new Operation { tags = new List <string> { SwaggerDocumentHelper.GetResourcePluralName(swaggerResource.Resource) .ToCamelCase() }, summary = "Retrieves deleted resources based on change version.", description = "The DELETES operation is used to retrieve deleted resources.", operationId = $"deletes{swaggerResource.Resource.PluralName}", deprecated = swaggerResource.IsDeprecated, consumes = new[] { _contentTypeStrategy.GetOperationContentType( swaggerResource, ContentTypeUsage.Writable) }, parameters = new List <Parameter> { new Parameter { @ref = SwaggerDocumentHelper.GetParameterReference("offset") }, new Parameter { @ref = SwaggerDocumentHelper.GetParameterReference("limit") }, new Parameter { @ref = SwaggerDocumentHelper.GetParameterReference("MinChangeVersion") }, new Parameter { @ref = SwaggerDocumentHelper.GetParameterReference("MaxChangeVersion") } }, responses = SwaggerDocumentHelper.GetReadOperationResponses( _pathsFactoryNamingStrategy.GetResourceName(swaggerResource, ContentTypeUsage.Readable), true) }); }