-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Rest2LDAP CREST API descriptors ignore read-only collection sub-resources #6
Comments
At first, I thought this issue was just an oversight on ForgeRock's part, since So, I tried adding this to the handler, to ensure that the final class ReadOnlyRequestHandler extends AbstractRequestHandler {
// ... lines omitted ...
@Override
public ApiDescription api(ApiProducer<ApiDescription> producer) {
if (delegate instanceof Describable) {
return ((Describable<ApiDescription, Request>)delegate).api(producer);
}
else {
return super.api(producer);
}
} However, this didn't work. I got this error:
The issue is that the code tries to generate two different service descriptions, but use the same name for both; they both get created as That's why the attached |
Side note: |
Corrects three obscure defects in the Rest2LDAP implementation of CREST descriptors: - Read-only sub-resources were not appearing at all in the CREST API description JSON. - When read-only sub-resources appeared in the API description alongside writable sub-resources for the same models, the generated service name for the sub-resources was the same, leading to an IllegalStateException. Now, we generate a unique service name for each sub-resource based on its writability. - A top-level `create` request was still being rendered in the API description for read-only sub-resources.
…y-desc Fix read-only sub-resource CREST API descr (#6)
This reverts commit 40be863.
Summary
If a collection sub-resource defined in the Rest2LDAP endpoints JSON file is marked
"isReadOnly": true
, that endpoint does not appear at all in the API descriptor returned by CREST.Affected Version
master
(4.0.0-SNAPSHOT
)Steps to Reproduce
example-v1.json
file, and add the following underresourceTypes/example-v1/subResources
(ensure you don't remove the existingusers
andgroups
sub-resource definitions):2, Alter the
Rest2LdapJsonConfiguratorTest
, adding the lineSystem.out.println(prettyPrint(api));
right after theparseJson(prettyPrint(api));
line.3. Run the test.
4. Observe the console output from the test.
Expected results
The output includes the new
all-users
sub-resource, even though it's read-only. Something like the attachedexpected.json
.Actual results
The output omits all read-only collection sub-resources. See the attached
actual.json
.Attachments
actual vs. expected JSON.zip
The text was updated successfully, but these errors were encountered: