JSON - 为特定架构指定的无效模型架构

时间:2017-12-06 14:21:22

标签: json

我制作了一个模型,我在API网关中遇到了麻烦。 如果有人能指出我在代码中的某个地方,我会非常感激。

重点是我试图在那里构建一个似乎无法正确构建的数组。我正在使用几个文档来执行它,但我失败了。

提前致谢并致以最诚挚的问候。



{
	"$schema": "http://json-schema.org/draft-04/schema#",
	"title": "GetUser",
	"type": "object",
	"properties": {
		"user_id": {
			"type": "number"
		},
		"shop_id": {
			"type": "number"
		},
		"email": {
			"type": "string"
		},
		"first_name": {
			"type": "string"
		},
		"last_name": {
			"type": "string"
		},
		"gender_title": {
			"type": "string"
		},
		"language": {
			"type": "string"
		}
	},
	"birthday": {
		"type": "array",
		"items": {
			"type": "object",
			"properties": {
				"day": {
					"type": "number"
				},
				"month": {
					"type": "string"
				},
				"year": {
					"type": "number"
				},

				"loyality_club_points": {
					"type": "number"
				},
				"levels_points": {
					"type": "array",
					"items": {
						"points": {
							"type": "number"
						},
						"order_tax": {
							"type": "number"
						}

					}
				}
			}
		}
	}
}




1 个答案:

答案 0 :(得分:0)

我想要的是:

{
"user_id":          ,(number)
"shop_id":          ,(number)
"email":            ,(string)
"first_name":       ,(string)
"last_name":        ,(string)
"gender_title":     ,(string)
"language":         ,(string)
"birthday":         
    {
       "day":      ,(number)
       "month":    ,(string)
       "year":      (number)
    },
"loyalty_club_points":      ,(number)
"levels_points": 
[
    { 
       "points": 150,
       "order_tax": 3
    },
   { 
       "points": 250,
       "order_tax": 6
    },
   { 
       "points": 350,
       "order_tax": 9
    },
   { 
       "points": 550,
       "order_tax": 12
    },
   { 
      "points": 1000,
      "order_tax": 32
   }

] }