File Meta

It has details of the file(s) which are part of the request or response.

Possible Locations

Child Elements

Attributes


Name Type Description
disallowed-extensions String (CSV) The list of file extensions that are not accepted.
content-types String (CSV) The list of possible content types of the file. Click here for sample content types.
size Integer (CSV) The minimum and maximum possible size of the file in bytes like size="0,100".
You can also opt to configure only the maximum size.
overall-size Integer The maximum combined size of all the files.
import-url Boolean Denotes whether the file should be read using URL.
  • true: The file will be read using the provided URL.
  • false (default): The file will not be read using the URL.
continue-on-error Boolean Represents whether the validation should continue when one of the uploaded files does not
meet the configured expectations.
  • true: The validation will continue even if one or more files throw error.
  • false (default): The validation will not continue if any one of the files throw error.

Note:

The import-url attribute can be used only when the file meta is declared under the <request-body>.

Example

Consider that we want to create a <property> called tourist_spots that holds the images of tourist places in the destination resource. The following are the requirements that should be configured for that field.

    
copy
Minimum and maximum allowed size of each file: 500 to 1500 bytes Maximum number of files that can be uploaded: 5 3 files: png format 2 files: jpg format - The overall size of the 5 files should not exceed 6000 bytes. - File name should not contain integers and double quotes. It should have minimum 5 and maximum 10 characters.

With all these details, now write the property as shown here,

    
copy
<property type="file" name="tourist_spots" length="5"> <file-meta size="500,1500" overall-size="6000" import-url="false" continue-on-error="true"> <extension name="png" size="500,1000" length="3"/> <extension name="jpg" length="2"/> <file-name regex="^[^\"0-9]+$" length="5,10" /> </file-meta> </property>

Last Updated 2025-05-30 16:54:59 +0530 +0530