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

feat(java): support validating a json based authorization model #245

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ewanharris
Copy link
Member

@ewanharris ewanharris commented Apr 24, 2024

Description

Implements a validateJson function for the Java package and then adds the JSON only errors that we have added since the Java package was written. It also updates the java-sdk to latest to pull in the modular models metadata

Naming wise, I stuck with the existing JS function names of validateDsl and validateJson, I also renamed the overall class to ModelValidator as it's no longer solely serving the purpose of DSL validation.

References

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

@ewanharris ewanharris requested a review from a team as a code owner April 24, 2024 17:42
@@ -8,7 +8,7 @@ public class ModelValidationSingleError extends ParsingError {
public ModelValidationSingleError() {}

public ModelValidationSingleError(ErrorProperties properties, ValidationMetadata metadata) {
super("syntax", properties);
super("validation", properties);
Copy link
Member Author

Choose a reason for hiding this comment

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

This should have been validation as that's what it is in JS

@@ -53,20 +64,30 @@ private void validate() throws DslErrorsException {
errors.raiseSchemaVersionRequired(0, "");
}

if (schemaVersion != null && schemaVersion.equals("1.1")) {
if (schemaVersion != null && (schemaVersion.equals("1.1") || schemaVersion.equals("1.2"))) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if there's an easy way we want to handle this

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.

None yet

1 participant