Ejemplo n.º 1
0
        private IList <Parameter> CreateGetByExampleParameters(SwaggerPathsResource swaggerResource)
        {
            var parameterList = CreateQueryParameters()
                                .Concat(
                swaggerResource.DefaultGetByExampleParameters.Select(
                    p => new Parameter {
                @ref = SwaggerDocumentHelper.GetParameterReference(p)
            }))
                                .ToList();

            swaggerResource.RequestProperties.ForEach(
                x =>
            {
                parameterList.Add(
                    new Parameter
                {
                    name = x.PropertyName.ToCamelCase(),
                    @in  = swaggerResource.IsPathParameter(x)
                                ? "path"
                                : "query",
                    description       = SwaggerDocumentHelper.PropertyDescription(x),
                    type              = SwaggerDocumentHelper.PropertyType(x),
                    format            = x.PropertyType.ToOpenApiFormat(),
                    required          = swaggerResource.IsPathParameter(x),
                    isIdentity        = SwaggerDocumentHelper.GetIsIdentity(x),
                    maxLength         = SwaggerDocumentHelper.GetMaxLength(x),
                    isDeprecated      = SwaggerDocumentHelper.GetIsDeprecated(x),
                    deprecatedReasons = SwaggerDocumentHelper.GetDeprecatedReasons(x)
                });
            });

            return(parameterList);
        }