jsonschema - How to create an integer, json-schema, validation rule that validates an integer is not equal to 0(zero)?
问题描述
I would like to validate an integer value (property) on not being 0(zero). Positive and negative integers are allowed, except 0.
解决方案
You can use not
enum
: {"type":"integer", "not":{"enum":[0]}}
.
Or not
const
with recent JSON Schema revision: {"type":"integer", "not":{"const":0}}
推荐阅读
- python - 为什么我的标题图像从我的模板中消失了?
- python - 在包含特定位置的特定项目的列表列表中删除列表
- amazon-dynamodb - 全局或二级索引是否有助于加快查询中的 FilterExpression
- aws-cdk - 如何将 swagger 文件与 aws_apigateway 集成
- mongodb - 基于 ObjectId 聚合和减少嵌套数组
- reactjs - 为什么 highcharts 在重新渲染时会缩小?
- function - 计算给定数字绝对值的函数
- r - 如何使用另一列中的值和条件填充列
- c# - 文件保存后打不开
- java - Android 在 KeyStore 中注册密钥文件