Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
Bryan Frimin
2026-06-22 11:33:47 +02:00
parent cb7fb8f5e9
commit 87f769a816
3 changed files with 16 additions and 3 deletions

View File

@@ -76,15 +76,19 @@ func normalizeRequiredJSON(data []byte) ([]byte, error) {
if err != nil {
return nil, err
}
obj["items"] = n
}
if addlRaw, ok := obj["additionalProperties"]; ok {
n, err := normalizeRequiredJSON(addlRaw)
if err != nil {
return nil, err
}
obj["additionalProperties"] = n
}
return json.Marshal(obj)
}
@@ -114,6 +118,7 @@ func normalizeRequiredJSON(data []byte) ([]byte, error) {
if err != nil {
return nil, err
}
required = append(required, name)
requiredSet[name] = true
}
@@ -125,6 +130,7 @@ func normalizeRequiredJSON(data []byte) ([]byte, error) {
if err != nil {
return nil, err
}
obj["properties"] = propsData
if len(required) > 0 {
@@ -132,6 +138,7 @@ func normalizeRequiredJSON(data []byte) ([]byte, error) {
if err != nil {
return nil, err
}
obj["required"] = reqData
}
@@ -157,6 +164,7 @@ func makeNullableJSON(data []byte) ([]byte, error) {
arr, _ := json.Marshal([]string{single, "null"})
obj["type"] = arr
}
return json.Marshal(obj)
}
@@ -165,9 +173,11 @@ func makeNullableJSON(data []byte) ([]byte, error) {
if slices.Contains(arr, "null") {
return data, nil
}
arr = append(arr, "null")
nullable, _ := json.Marshal(arr)
obj["type"] = nullable
return json.Marshal(obj)
}

View File

@@ -241,6 +241,7 @@ func (s *Service) RenderRobotsTxt(
func (s *Service) fetchDocumentIDs(ctx context.Context, scope coredata.Scoper, orgID gid.GID) ([]string, error) {
seen := make(map[gid.GID]struct{})
var resourceIDs []gid.GID
appendResourceID := func(id gid.GID) {