conformsToCommonCore method
Check whether a service conforms to the Core
conformance class of the
OGC API - Common - Part 1: Core
standard.
Optionally also check whether it supports landingPage
, json
, html
and/or openAPI30
.
Examples:
// Require the `Core` conformance class. Other classes could be
// supported or not.
conformsToCommonCore();
// Require `Core` and `JSON` conformance classes. Other classes
// could be supported or not.
conformsToCommonCore(json: true);
// Require `Core` and `JSON` conformance classes, and require
// NOT conforming to `HTML`. Other classes could be supported or not.
conformsToCommonCore(json: true, html: false);
Implementation
bool conformsToCommonCore({
bool? landingPage,
bool? json,
bool? html,
bool? openAPI30,
}) {
var isCore = false;
var isLandingPage = false;
var isJSON = false;
var isHTML = false;
var isOpenAPI30 = false;
for (final id in classes) {
if (!isCore && id == common1Core) {
isCore = true;
}
if (!isLandingPage && id == common1LandingPage) {
isLandingPage = true;
}
if (!isHTML && id == common1HTML) {
isHTML = true;
}
if (!isJSON && id == common1JSON) {
isJSON = true;
}
if (!isOpenAPI30 && id == common1OpenAPI30) {
isOpenAPI30 = true;
}
}
return isCore &&
(landingPage == null || isLandingPage == landingPage) &&
(json == null || isJSON == json) &&
(html == null || isHTML == html) &&
(openAPI30 == null || isOpenAPI30 == openAPI30);
}