Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add artifacts for catalog request message #69

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"title": "CatalogRequestMessageSchema",
"type": "object",
"allOf": [
{
"$ref": "#/definitions/CatalogRequestMessage"
}
],
"$id": "https://w3id.org/dspace/2024/1/catalog/catalog-request-message-schema.json",
"definitions": {
"CatalogRequestMessage": {
"type": "object",
"properties": {
"@context": {
"$ref": "https://w3id.org/dspace/2024/1/common/context-schema.json"
},
"@type": {
"type": "string",
"const": "CatalogRequestMessage"
},
"filter": {
"type": "array"
}
},
"required": [
"@context",
"@type"
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"@context": [
"https://w3id.org/dspace/2024/1/context.json"
],
"@type": "CatalogRequestMessage",
"filter": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,10 @@ void verifyNestedCatalog() {
verifyRoundTrip("/catalog/example/nested-catalog.json",
"/catalog/catalog-schema.json");
}

@Test
void verifyCatalogRequestMessage() {
verifyRoundTrip("/catalog/example/catalog-request-message.json",
"/catalog/catalog-request-message-schema.json");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change this to SAP?

* Copyright (c) 2024 Metaform Systems, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Metaform Systems, Inc. - initial API and implementation
* SAP SE - extension to catalog request message
*
*/

package org.eclipse.dsp.schema.catalog;

import org.eclipse.dsp.schema.fixtures.AbstractSchemaTest;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.io.IOException;

import static org.assertj.core.api.Assertions.assertThat;

public class CatalogRequestMessageSchemaTest extends AbstractSchemaTest {

@Test
void verifySchema() throws IOException {
var node = mapper.readTree(getClass().getResourceAsStream("/catalog/example/catalog-request-message.json"));
assertThat(schema.validate(node)).isEmpty();
}

@BeforeEach
void setUp() {
setUp("/catalog/catalog-request-message-schema.json");
}


}
Loading