#!/usr/bin/env bash sedCommand="sed" if [ "$(uname)" == "Darwin" ]; then if hash gsed 2>/dev/null; then sedCommand="gsed" fi fi function addAnnotation() { local match=$1 local annotation=$2 local file=$3 $sedCommand -i "/^.*${match}.*/i ${annotation}" ${file} } addAnnotation \ "protected List subGroups;" \ "@io.fabric8.crd.generator.annotation.SchemaFrom(type = org.keycloak.representations.overrides.NoSubGroupsGroupRepresentationList.class)" \ target/keycloak-core/org/keycloak/representations/idm/GroupRepresentation.java addAnnotation \ "private MultivaluedHashMap components;" \ "@io.fabric8.crd.generator.annotation.SchemaFrom(type = org.keycloak.representations.overrides.ComponentExportRepresentationMap.class)" \ target/keycloak-core/org/keycloak/representations/idm/RealmRepresentation.java addAnnotation \ "private MultivaluedHashMap config;" \ "@io.fabric8.crd.generator.annotation.SchemaFrom(type = org.keycloak.representations.overrides.MultivaluedStringStringHashMap.class)" \ target/keycloak-core/org/keycloak/representations/idm/CredentialRepresentation.java addAnnotation \ "private MultivaluedHashMap config;" \ "@io.fabric8.crd.generator.annotation.SchemaFrom(type = org.keycloak.representations.overrides.MultivaluedStringStringHashMap.class)" \ target/keycloak-core/org/keycloak/representations/idm/ComponentRepresentation.java addAnnotation \ "private MultivaluedHashMap subComponents = new MultivaluedHashMap<>();" \ "@io.fabric8.crd.generator.annotation.SchemaFrom(type = org.keycloak.representations.overrides.NoSubcomponentsComponentExportRepresentationMap.class)" \ target/keycloak-core/org/keycloak/representations/idm/ComponentExportRepresentation.java addAnnotation \ "private MultivaluedHashMap config = new MultivaluedHashMap<>();" \ "@io.fabric8.crd.generator.annotation.SchemaFrom(type = org.keycloak.representations.overrides.MultivaluedStringStringHashMap.class)" \ target/keycloak-core/org/keycloak/representations/idm/ComponentExportRepresentation.java addAnnotation \ "private List policies;" \ "@com.fasterxml.jackson.annotation.JsonIgnore" \ target/keycloak-core/org/keycloak/representations/idm/authorization/ScopeRepresentation.java addAnnotation \ "private List resources;" \ "@com.fasterxml.jackson.annotation.JsonIgnore" \ target/keycloak-core/org/keycloak/representations/idm/authorization/ScopeRepresentation.java