-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #905 from ctron/feature/optional_schema_1
[#903]: Make schema optional, allow alternate content type
- Loading branch information
Showing
10 changed files
with
241 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
...main/java/org/eclipse/ditto/services/gateway/util/config/endpoints/CloudEventsConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright (c) 2020 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.eclipse.ditto.services.gateway.util.config.endpoints; | ||
|
||
import java.util.Set; | ||
|
||
import javax.annotation.concurrent.Immutable; | ||
|
||
import akka.http.javadsl.model.MediaTypes; | ||
import org.eclipse.ditto.model.base.common.DittoConstants; | ||
import org.eclipse.ditto.services.utils.config.KnownConfigValue; | ||
|
||
import static org.eclipse.ditto.model.base.common.DittoConstants.DITTO_PROTOCOL_CONTENT_TYPE; | ||
|
||
/** | ||
* Provides configuration settings for the cloud events endpoint of the Ditto Gateway service. | ||
*/ | ||
@Immutable | ||
public interface CloudEventsConfig { | ||
|
||
/** | ||
* Returns if an empty data schema is allowed. | ||
* | ||
* @return {@code true} if an empty data schema is allowed {@code false} otherwise. | ||
*/ | ||
boolean isEmptySchemaAllowed(); | ||
|
||
/** | ||
* Returns the allowed data types. | ||
* | ||
* @return The set of allowed data types. | ||
*/ | ||
Set<String> getDataTypes(); | ||
|
||
/** | ||
* An enumeration of the known config path expressions and their associated default values for | ||
* {@code CloudEventsConfig}. | ||
*/ | ||
enum CloudEventsConfigValue implements KnownConfigValue { | ||
|
||
/** | ||
* Flag if an empty data schema is allowed. | ||
*/ | ||
EMPTY_SCHEMA_ALLOWED("empty-schema-allowed", true), | ||
|
||
/** | ||
* Set of allowed data types | ||
*/ | ||
DATA_TYPES("data-types", Set.of(MediaTypes.APPLICATION_JSON.toString(), DittoConstants.DITTO_PROTOCOL_CONTENT_TYPE)); | ||
|
||
private final String path; | ||
private final Object defaultValue; | ||
|
||
private CloudEventsConfigValue(final String thePath, final Object theDefaultValue) { | ||
path = thePath; | ||
defaultValue = theDefaultValue; | ||
} | ||
|
||
@Override | ||
public Object getDefaultValue() { | ||
return defaultValue; | ||
} | ||
|
||
@Override | ||
public String getConfigPath() { | ||
return path; | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.