diff --git a/specification/cognitiveservices/data-plane/FormRecognizer/preview/v1.0/FormRecognizer.json b/specification/cognitiveservices/data-plane/FormRecognizer/preview/v1.0/FormRecognizer.json index febeee2f6215..ae94b69a285d 100644 --- a/specification/cognitiveservices/data-plane/FormRecognizer/preview/v1.0/FormRecognizer.json +++ b/specification/cognitiveservices/data-plane/FormRecognizer/preview/v1.0/FormRecognizer.json @@ -69,6 +69,9 @@ "x-ms-examples": { "Train new model example": { "$ref": "./examples/Train.json" + }, + "Train new model example, subfolder filter options": { + "$ref": "./examples/TrainWithSubFolders.json" } } } @@ -296,6 +299,26 @@ "maxLength": 2048, "minLength": 0, "type": "string" + }, + "sourceFilter":{ + "$ref":"#/definitions/TrainSourceFilter", + "description":"Get or set filter to further search the\r\nsource path for content." + } + } + }, + "TrainSourceFilter":{ + "description":"Filters to be applied when traversing a data source.", + "type":"object", + "properties":{ + "prefix":{ + "description":"A case-sensitive prefix string to filter content\r\nunder the source location. For e.g., when using a Azure Blob\r\nUri use the prefix to restrict subfolders for content.", + "maxLength":128, + "minLength":0, + "type":"string" + }, + "includeSubFolders":{ + "description":"A flag to indicate if sub folders within the set of\r\nprefix folders will also need to be included when searching\r\nfor content to be preprocessed.", + "type":"boolean" } } }, diff --git a/specification/cognitiveservices/data-plane/FormRecognizer/preview/v1.0/examples/TrainWithSubFolders.json b/specification/cognitiveservices/data-plane/FormRecognizer/preview/v1.0/examples/TrainWithSubFolders.json new file mode 100644 index 000000000000..40dc153c23aa --- /dev/null +++ b/specification/cognitiveservices/data-plane/FormRecognizer/preview/v1.0/examples/TrainWithSubFolders.json @@ -0,0 +1,55 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "{API key}", + "body": {}, + "trainRequest": { + "source": "/input/data", + "sourceFilter": { + "prefix": "", + "includeSubFolders": false + } + } + }, + "responses": { + "200": { + "body": { + "modelId": "ad1901b6-ddaa-4249-8938-3f03f65cc893", + "trainingDocuments": [ + { + "documentName": "0.pdf", + "pages": 1, + "errors": [], + "status": "success" + }, + { + "documentName": "1.pdf", + "pages": 1, + "errors": [], + "status": "success" + }, + { + "documentName": "2.pdf", + "pages": 1, + "errors": [], + "status": "success" + }, + { + "documentName": "3.pdf", + "pages": 1, + "errors": [], + "status": "success" + }, + { + "documentName": "4.pdf", + "pages": 1, + "errors": [], + "status": "success" + } + ], + "errors": [] + } + } + } +}