# Uri Decorator validation property parameter schema

Module
import { Uri } from "@tsed/schema"
Source/packages/schema/src/decorators/common/format.ts

# Overview

function Uri(): (...args: any[]) => any;

# Description

Apply a uri validation on property.

# Example

# With primitive type

class Model {
   @Uri()
   property: string;
}
1
2
3
4

Will produce:

{
  "type": "object",
  "properties": {
    "property": {
      "type": "string",
      "format": "uri"
    }
  }
}
1
2
3
4
5
6
7
8
9

# With array type

class Model {
   @Uri()
   @CollectionOf(String)
   property: string[];
}
1
2
3
4
5

Will produce:

{
  "type": "object",
  "properties": {
    "property": {
      "type": "array",
      "items": {
         "type": "string",
         "format": "uri"
      }
    }
  }
}
1
2
3
4
5
6
7
8
9
10
11
12

See Format decorator.

Other topics