1

I tried with both way in .yaml file ,

email:
  name: email 
  description: Client email
  required: true
  type: string
  format: email
  in: formData


email:
  name: email 
  description: Client email
  required: true
  type: email
  in: formData

can some one point out the correct way?

Abhishek saharn
  • 927
  • 9
  • 23
Asanka
  • 552
  • 6
  • 15

3 Answers3

2

At the schema, you have to put the value of the example. Sometimes the email format is not interpreted well, it happens me with the Swashbuckle Nuget library. I mean, even if the format is email, it wouldn't generate the right example value in Swagger-UI.

email:
  name: email 
  description: Client email
  required: true
  type: string
  format: email
  example: user@example.com
  in: formData
isaacfi
  • 190
  • 1
  • 9
1

Name is only a field of any resource. If you have a user, for example, the definition will be like this:

User:
  title: Simple user
  type: object
  properties:
    email:
      type: string
      format: email
    password:
      type: string
IKavanagh
  • 6,089
  • 11
  • 42
  • 47
SebaReal
  • 161
  • 2
  • 7
0

Please refer This release note

It says that by default format validation is disabled and for more complex formats such as email addresses, support will probably still vary significantly. It’s unclear how many implementations have ever provided this level of support.

Chintan Pandya
  • 338
  • 4
  • 14