Skip to content

Commit

Permalink
Allow .:,; in batch request id
Browse files Browse the repository at this point in the history
  • Loading branch information
hylkevds committed Aug 29, 2024
1 parent b1560c6 commit d3387a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
public class JsonBatchProcessor implements Iterator<JsonBatchResultItem> {

private static final Logger LOGGER = LoggerFactory.getLogger(JsonBatchProcessor.class.getName());
private static final String REFERENCE_URL_REGEX = "^" + Pattern.quote("$") + "([a-zA-Z0-9_-]+)";
private static final String REFERENCE_URL_REGEX = "^" + Pattern.quote("$") + "([a-zA-Z0-9_.:,;-]+)";
private static final Pattern REFERENCE_URL_PATTERN = Pattern.compile(REFERENCE_URL_REGEX);
private static final String REFERENCE_JSON_REGEX = Pattern.quote("\"$") + "([a-zA-Z0-9_-]+)" + Pattern.quote("\"");
private static final String REFERENCE_JSON_REGEX = Pattern.quote("\"$") + "([a-zA-Z0-9_.:,;-]+)" + Pattern.quote("\"");
private static final Pattern REFERENCE_JSON_PATTERN = Pattern.compile(REFERENCE_JSON_REGEX);

private final Service service;
Expand Down
11 changes: 6 additions & 5 deletions docs/extensions/JsonBatchRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ The following example shows a Batch Request that contains the following operatio
## Referencing new entities in a change set example


Actions can reference entities previously created. To make a created entity referenceable, the POST that creates the entity must have
a id property, the content of which can be any string. Subsequent requests in the same
change set can now use the value of this property, prefixed with a $, in places where the ID of the
created entity is required.
Actions can reference entities previously created or fetched.
To make a created entity referenceable, the POST that creates the entity must have a id property,
the content of which must be a string limited to the characters `a-zA-Z0-9_.:,;-`.
Subsequent requests in the same change set can now use the value of this property, prefixed with a $,
in places where the ID of the created entity is required.

Example: A Batch Request that containing a single change set that contains the following requests:

Expand Down Expand Up @@ -157,7 +158,7 @@ If the result of the GET is an entity set, the first entity of the set is used.
### Skipping requests in a batch

Requests in a batch can be skipped using the `if` property.
The value of `if` is a reference a preceding request, optionally prefixed with `not `.
The value of `if` is a reference to a preceding request, optionally prefixed with `not `.

An example, creating an ObservedProperty only if no ObservedProperty with a name `Temperature` already exists:
```
Expand Down

0 comments on commit d3387a9

Please sign in to comment.