Swagger.ObjectModel.Builders.OperationBuilder.Build C# (CSharp) Method

Build() public method

The build.
public Build ( System.Operation provided = null ) : System.Operation
provided System.Operation
return System.Operation
        public Operation Build(Operation provided = null)
        {
            if (this.responses == null)
            {
                throw new RequiredFieldException("Responses");
            }

            if (this.responses.Count < 1)
            {
                throw new InvalidOperationException(
                    "The Responses Object MUST contain at least one response code, and it SHOULD be the response for a successful operation call.");
            }
            
            provided = provided ?? new Operation();

            provided.Tags = this.tags;
            provided.Summary = this.summary;
            provided.Description = this.description;
            provided.ExternalDocumentation = this.documentation;
            provided.OperationId = this.operationId;
            provided.Consumes = this.consumes;
            provided.Produces = this.produces;
            provided.Parameters = this.parameters;
            provided.Responses = this.responses;
            provided.Schemes = this.schemes;
            provided.Deprecated = this.deprecated;
            provided.SecurityRequirements = this.securityRequirements;
            return provided;
        }

Usage Example

 /// <summary>
 /// Defines the operation for the path and method;
 /// </summary>
 /// <param name="operation">
 /// The operation.
 /// </param>
 /// <returns>
 /// The <see cref="PathItemBuilder"/>.
 /// </returns>
 public PathItemBuilder Operation(Action<OperationBuilder> action)
 {
     var builder = new OperationBuilder();
     action(builder);
     builder.Build(this.operation);
     return this;
 }
All Usage Examples Of Swagger.ObjectModel.Builders.OperationBuilder::Build