[MGNLREST-157] Endpoint doesn't get updated after decorating intially Created: 01/Dec/17 Updated: 18/Dec/17 Resolved: 18/Dec/17 |
|
| Status: | Closed |
| Project: | Magnolia REST Framework |
| Component/s: | None |
| Affects Version/s: | 2.0.1 |
| Fix Version/s: | 2.0.1 |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Hieu Nguyen Duc | Assignee: | Dai Ha |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | 0d | ||
| Time Spent: | 2d 3.5h | ||
| Original Estimate: | 5.5h | ||
| Attachments: |
|
||||||||||||
| Issue Links: |
|
||||||||||||
| Template: |
|
||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||||||
| Date of First Response: | |||||||||||||
| Sprint: | Saigon 125, Saigon 126 | ||||||||||||
| Story Points: | 1 | ||||||||||||
| Description |
|
Since I'm not sure whether this issue comes from "rest" or "main", feel free to move it to correct place. Steps to reproduce: + Add "rest-test" to your light module folder |
| Comments |
| Comment by Mikaël Geljić [ 04/Dec/17 ] |
|
Goal is first to validate where solution for |
| Comment by Dai Ha [ 06/Dec/17 ] |
|
Rest is using customized logic to addDecorator as below:
@Override
public void addDecorator(DefinitionDecorator<EndpointDefinition> decorator) {
Optional<DefinitionProvider<EndpointDefinition>> targetProvider = getAllProviders().stream()
.filter(decorator::appliesTo)
.findFirst();
super.addDecorator(decorator);
targetProvider.ifPresent(provider -> systemEventBus.fireEvent(new EndpointDefinitionRegistryEvent(REREGISTERED, provider)));
}
Definition is decorated in getAllProviders() call, with a valid provider. In case of new decoration file is added in light module, decoration process is trigger without an existing decorator to handle decoration -> the definition is the original one. Suggesstion: super.addDecorator(decorator) should be called before getAllProviders(). Sample code:
@Override
public void addDecorator(DefinitionDecorator<EndpointDefinition> decorator) {
super.addDecorator(decorator);
Optional<DefinitionProvider<EndpointDefinition>> targetProvider = getAllProviders().stream()
.filter(decorator::appliesTo)
.findFirst();
if(!targetProvider.isPresent()) {
super.removeDecorator(decorator);
}
targetProvider.ifPresent(provider -> systemEventBus.fireEvent(new EndpointDefinitionRegistryEvent(REREGISTERED, provider)));
}
|