Skip to content

Files

Latest commit

 

History

History
23 lines (17 loc) · 1 KB
·

File metadata and controls

23 lines (17 loc) · 1 KB
·
title section prev next
Enumerated and constant values
docs
label url
Dialect and vocabulary declaration
/understanding-json-schema/reference/schema
label url
Enumerated values
/understanding-json-schema/reference/enum

The enum and const keywords contribute to data validation by defining limits on the values a property can hold.

  • Define a set of values. Use the enum keyword to specify a finite set of acceptable values for a property. This ensures that only predefined options are valid.

  • Define a fixed, single value. Use the const keyword to force a property to have a single, fixed value. This keyword is more restrictive than enum.

Learn more about how to use these keywords with the following resources:

By effectively utilizing these keywords, you can significantly enhance the reliability and accuracy of your JSON data.