I am trying to write my own filter and am having an issue with setting the 
schema.ref

My Apply method currently looks something like this:

public void Apply(Operation operation, SchemaRegistry schemaRegistry, 
ApiDescription apiDescription)
{
    if (operation.operationId == "Image_Test")
    {
        operation.consumes.Add("multipart/form-data");
        operation.parameters = new List<Parameter>
        {
            new Parameter
            {
                name = "imageJson",
                required = true,
                description = "Image data (json)",
                @in = "formData",
                type = "string",
                schema = new Schema {@ref = "ImageData"}
            },
            new Parameter
            {
                name = "fileStream",
                required = true,
                type = "file",
                description = "File stream",
                @in = "formData"
            }
        };
    }
}


When I start my service, I see the ImageData model correctly defined under 
the DataType column, but I am also getting the following validation error:

{"messages":["attribute paths.'/api/Image/AddWithFile'(post).[imageJson].schema 
is 
unexpected"],"schemaValidationMessages":[{"level":"error","domain":"validation","keyword":"oneOf","message":"instance
 failed to match exactly one schema (matched 0 out of 
2)","schema":{"loadingURI":"http://swagger.io/v2/schema.json#","pointer":"/definitions/parametersList/items"},"instance":{"pointer":"/paths/~1api~1Image~1AddWithFile/post/parameters/0"}}]}

What am I doing wrong in my filter?

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to