use of com.google.cloud.datacatalog.v1beta1.Schema in project policies-ui-backend by RedHatInsights.
the class OapiTest method validateOpenApi.
@Test
void validateOpenApi() throws Exception {
OpenApi3 model = new OpenApi3Parser().parse(url, true);
System.out.printf("OpenAPI Model at %s\n", url);
if (!model.isValid()) {
for (ValidationResults.ValidationItem item : model.getValidationItems()) {
System.err.println(item);
}
fail("OpenAPI spec is not valid");
}
//
// Now that basic validation is done, we can add some of our own
//
Map<String, Path> paths = model.getPaths();
Map<String, Schema> schemas = model.getSchemas();
// The base path filler. See also OASModifier.mangleName
assertTrue(paths.containsKey("/"));
// User config is private, so don't show it
assertFalse(paths.containsKey("/user-config"));
assertFalse(schemas.containsKey("SettingsValues"));
// Check that openapi does not (again) collapse parameters
assertEquals(9, paths.get("/policies").getOperation("get").getParameters().size());
// Check that all properties are present ( https://github.com/smallrye/smallrye-open-api/issues/437 )
Map<String, Schema> policyProperties = schemas.get("Policy").getProperties();
assertEquals(9, policyProperties.size());
assertTrue(policyProperties.containsKey("ctime"));
assertTrue(policyProperties.containsKey("mtime"));
// Now that the OpenAPI file has been validated, save a copy to the filesystem
// This file is going to be uploaded in a regular CI build to know the API state
// for a given build.
InputStream in = url.openStream();
Files.copy(in, Paths.get(TARGET_OPENAPI), StandardCopyOption.REPLACE_EXISTING);
}
use of com.google.cloud.datacatalog.v1beta1.Schema in project efm-integrasjonspunkt by felleslosninger.
the class P360Client method sendEduMelding.
@Override
public PutMessageResponseType sendEduMelding(PutMessageRequestType request) {
JAXBElement<no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageRequestType> p360request = new PutMessageRequestMapper().mapFrom(request);
final WebServiceTemplate template = templateFactory.createTemplate("no.difi.meldingsutveksling.noarkexchange.p360.schema", PutMessageMarker.markerFrom(new PutMessageRequestWrapper(request)));
JAXBElement<no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageResponseType> response = (JAXBElement<no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageResponseType>) template.marshalSendAndReceive(settings.getEndpointUrl(), p360request, new SoapActionCallback(SOAP_ACTION));
PutMessageResponseType theResponse = new PutMessageResponseType();
ModelMapper modelMapper = new ModelMapper();
modelMapper.map(response.getValue(), theResponse);
setUnmappedValues(response, theResponse);
if (!isValid(theResponse)) {
theResponse = new PutMessageResponseType();
final no.difi.meldingsutveksling.noarkexchange.schema.AppReceiptType appReceiptType = new no.difi.meldingsutveksling.noarkexchange.schema.AppReceiptType();
theResponse.setResult(appReceiptType);
appReceiptType.setType("OK");
}
return theResponse;
}
use of com.google.cloud.datacatalog.v1beta1.Schema in project geotoolkit by Geomatys.
the class JAXBFeatureTypeWriter method write.
/**
* Write an XML representation of the specified featureType into the Writer.
*
* @param feature The featureType to marshall.
*/
public void write(FeatureType feature, Writer writer) throws JAXBException {
final Schema schema = getSchemaFromFeatureType(feature);
final Marshaller marshaller = POOL.acquireMarshaller();
marshaller.marshal(schema, writer);
POOL.recycle(marshaller);
}
use of com.google.cloud.datacatalog.v1beta1.Schema in project geotoolkit by Geomatys.
the class XSDSchemaContext method read.
public Map.Entry<Schema, String> read(final Object candidate) throws JAXBException {
Entry<Schema, String> schemaEntry = readSchema(candidate);
listAllSchemas(schemaEntry.getKey(), schemaEntry.getValue(), new ArrayList<>());
final Schema schema = schemaEntry.getKey();
targetNamespace = schema.getTargetNamespace();
final String location = schemaEntry.getValue();
// we build the base url to retrieve imported xsd;
final String baseLocation;
if (location == null) {
baseLocation = null;
} else if (location.lastIndexOf('/') != -1) {
baseLocation = location.substring(0, location.lastIndexOf('/') + 1);
} else {
baseLocation = location;
}
return new AbstractMap.SimpleImmutableEntry<>(schema, baseLocation);
}
use of com.google.cloud.datacatalog.v1beta1.Schema in project gapic-generator-java by googleapis.
the class AsyncCreateSchema method asyncCreateSchema.
public static void asyncCreateSchema() throws Exception {
// It may require modifications to work in your environment.
try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
CreateSchemaRequest request = CreateSchemaRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).setSchema(Schema.newBuilder().build()).setSchemaId("schemaId-697673060").build();
ApiFuture<Schema> future = schemaServiceClient.createSchemaCallable().futureCall(request);
// Do something.
Schema response = future.get();
}
}
Aggregations