From 6e6a8923f0f0eb88ca66cc3ed4772c391e88bc7d Mon Sep 17 00:00:00 2001 From: Ben C Date: Tue, 28 Jun 2022 00:41:42 -0400 Subject: [PATCH] Add `minItems`, `maxItems`, and `uniqueItems` to nomai coords --- NewHorizons/External/Configs/StarSystemConfig.cs | 10 +++++++++- SchemaExporter/SchemaExporter.cs | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/NewHorizons/External/Configs/StarSystemConfig.cs b/NewHorizons/External/Configs/StarSystemConfig.cs index bf4cef06..bfed6035 100644 --- a/NewHorizons/External/Configs/StarSystemConfig.cs +++ b/NewHorizons/External/Configs/StarSystemConfig.cs @@ -1,5 +1,5 @@ -using System.Collections.Generic; using System.ComponentModel; +using System.ComponentModel.DataAnnotations; using System.Linq; using NewHorizons.Utility; using Newtonsoft.Json; @@ -102,8 +102,16 @@ namespace NewHorizons.External.Configs public class NomaiCoordinates { + [MinLength(2)] + [MaxLength(6)] public int[] x; + + [MinLength(2)] + [MaxLength(6)] public int[] y; + + [MinLength(2)] + [MaxLength(6)] public int[] z; } diff --git a/SchemaExporter/SchemaExporter.cs b/SchemaExporter/SchemaExporter.cs index 87a701bd..7b0634fd 100644 --- a/SchemaExporter/SchemaExporter.cs +++ b/SchemaExporter/SchemaExporter.cs @@ -77,6 +77,14 @@ public static class SchemaExporter {"title", _title}, {"description", _description} }); + + if (_title == "Star System Schema") + { + schema.Definitions["NomaiCoordinates"].Properties["x"].UniqueItems = true; + schema.Definitions["NomaiCoordinates"].Properties["y"].UniqueItems = true; + schema.Definitions["NomaiCoordinates"].Properties["z"].UniqueItems = true; + } + return schema; } }