Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add InputDescriptor.toRequestOptions #109

Conversation

n0900
Copy link
Contributor

@n0900 n0900 commented Aug 19, 2024

Adds inverse operations to get back RequestOptions which were used to generate InputDescriptor.
This is useful if an incoming request needs to be manipulated.

@n0900 n0900 requested a review from nodh August 19, 2024 16:04
@n0900 n0900 self-assigned this Aug 19, 2024

representations.forEach { representation ->
"${representation.name}: RequestOptions -> InputDescriptor -> RequestOptions quasi equality" {
repeat(3) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why repeat it three times?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To get more permutations of requested attributes i.e. empty, all etc

}

/**
* Inverse operation of [RequestOptions.toInputDescriptor]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just add a little more documentation, i.e. when this would be needed?

@@ -121,6 +121,12 @@ data class RequestOptions(
/**
* Miscellaneous helper functions regarding [ConstraintField]
*/
private fun Collection<ConstraintField>.toRequestedAttributes(): List<String> {
val regex = "[a-zA-Z0-9_-]+".toRegex()
val rawAttributes = this.map { constraint -> constraint.path.last().split("[").last() }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems it should be handled by JSON Path? / cc @acrusage-iaik

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we cannot use schema-matching according to v2.0.0 or later this needs to be reworked.

@n0900 n0900 requested review from acrusage-iaik and removed request for acrusage-iaik August 20, 2024 12:04
@n0900 n0900 closed this Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants