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

duplicate keys across safe and unsafe params does not fail validation #285

Open
bavardage opened this issue Apr 16, 2019 · 0 comments
Open

Comments

@bavardage
Copy link

What happened?

I am able to produce an error definition with the same param name used both in unsafe-args and safe-args.

Conjure-java then happily produces non-compiling java code:

public static ServiceException myError(
            Throwable cause, int param, List<String> param) {
        return new ServiceException(
                MY_ERROR,
                cause,
                SafeArg.of("param", param),
                UnsafeArg.of("param", param));
    }

What did you want to happen?

I feel like the IR validation should protect against this.

I'm not sure whether it would be enough to change the .toSet() here to a .toList(): https://github.com/palantir/conjure/blob/master/conjure-core/src/main/java/com/palantir/conjure/defs/validator/ErrorDefinitionValidator.java#L34 (and change the unique names validator to take a Collection<>)?

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

No branches or pull requests

1 participant