Skip to content

Instantly share code, notes, and snippets.

Avatar

Florent Catiau-Tristant Kapcash

View GitHub Profile
@Kapcash
Kapcash / EnumRestreint.java
Created Oct 24, 2019
Java Spring validator decorator to restreint possibles values from Enum
View EnumRestreint.java
@Target({ FIELD })
@Retention(RUNTIME)
@Documented
@Constraint(validatedBy = { EnumRestreintValidator.class })
public @interface EnumRestreint {
String message() default "The enum value is not included in the possibles values.";
String[] authorizedFields() default {};
Class<?>[] groups() default {};
@Kapcash
Kapcash / ObservableSequence.ts
Created Sep 27, 2018
Recursive observable sequence, depending on previous response and concatening results
View ObservableSequence.ts
repeatRequests(req, endpoint, callback): any{
// Array of all results, returned to the subscribe
let tempArray = [];
// Recursive lambda function to chain all observables sequentially
const recursive = (req, endpoint, callback) => {
return this.httpService.get(endpoint).pipe(
flatMap((res) => {
callback(res.data.items);
// Concat all results in the result array
You can’t perform that action at this time.