public OpenApiSchema GenerateSchema(Type type, SchemaRepository schemaRepository)
        {
            type = (type.IsNullable() || type.IsFSharpOption())
                ? type.GenericTypeArguments[0]
                : type;

            return(_generatorChain.GenerateSchema(type, schemaRepository));
        }
        public OpenApiSchema GenerateSchema(Type type, SchemaRepository schemaRepository)
        {
            // Check if is nullable
            var isNullable = type.IsNullable() || type.IsFSharpOption();

            // Update type
            type = isNullable
                ? type.GenericTypeArguments[0]
                : type;

            var schema = _generatorChain.GenerateSchema(type, schemaRepository);

            // Set Nullable
            schema.Nullable = isNullable;

            return(schema);
        }
示例#3
0
        public OpenApiSchema GenerateSchema(Type type, SchemaRepository schemaRepository)
        {
            // Check if is nullable
            var isNullable = type.IsNullable() || type.IsFSharpOption();

            if (isNullable)
            {
                type = type.IsArray
                    ? type.GetGenericArguments()[0].MakeArrayType()
                    : type.GenericTypeArguments[0];
            }

            var schema = _generatorChain.GenerateSchema(type, schemaRepository);

            // Set Nullable
            schema.Nullable = isNullable;

            return(schema);
        }