question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bean Validation annotations are ignored if class is in dependency

See original GitHub issue

I’ve found a very strange issue.

I have two projects.

  1. Spring Boot App with Hilla
  2. Simply dependency with classes with Bean Validation annotations

The generator only generates the Model correctly for project 1 but not for project 2.

I assume the generator scans the source code, not the class files.

Example

public class Animal {

    @NotBlank
    @Email
    private String email;

is generated as

export default class AnimalModel<T extends Animal = Animal> extends ObjectModel<T> { 
  static createEmptyValue: () => Animal;

  get email(): StringModel {
    return this[_getPropertyModel]('email', StringModel, [true]);
  }
}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Legiothcommented, Aug 5, 2022

The original reason for parsing sources is that we wanted to carry over method parameter names and JavaDocs to the generated TS. The new architecture uses bytecode as the main input and then supplements with additional details from sources if available.

1reaction
cromotecacommented, Aug 5, 2022

That’s what version 1.2 does.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javax validation constraints annotations are ignoring during ...
For classes annotations, I use this: @Documented @Constraint(validatedBy = RestrictionsAreValidImpl.class) @Target(ElementType.
Read more >
Bean Validation annotations ignored · Issue #987 - GitHub
I see this is in swagger-core maven module which I would say SpringFox project does not add as a dependency... That is a...
Read more >
Hibernate Validator 8.0.0.Final - Jakarta Bean Validation ...
When applying constraints on an Iterable type argument, Hibernate Validator will validate each element. Example 2.3, “Container element ...
Read more >
Chapter 18. Bean Validation Support
Validation is a process of verifying that some data obeys one or more pre-defined constraints. This chapter describes support for Bean Validation in...
Read more >
Bean Validation specification
A constraint is said to be cross-parameter if it has one constraint validator targeting the array of parameters of a method or constructor...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found