Ver a proveniência

fix field include/exclude check for OpenApiSchema

tags/2.0.1
Jonathan Cobb há 3 anos
ascendente
cometimento
6e26fe655a
2 ficheiros alterados com 6 adições e 5 eliminações
  1. +3
    -4
      wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/EntityConfig.java
  2. +3
    -1
      wizard-server/src/main/java/org/cobbzilla/wizard/server/config/OpenApiConfiguration.java

+ 3
- 4
wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/EntityConfig.java Ver ficheiro

@@ -27,8 +27,7 @@ import java.lang.reflect.Method;
import java.util.*;

import static lombok.AccessLevel.PRIVATE;
import static org.cobbzilla.util.daemon.ZillaRuntime.empty;
import static org.cobbzilla.util.daemon.ZillaRuntime.shortError;
import static org.cobbzilla.util.daemon.ZillaRuntime.*;
import static org.cobbzilla.util.json.JsonUtil.NOTNULL_MAPPER;
import static org.cobbzilla.util.json.JsonUtil.json;
import static org.cobbzilla.util.reflect.ReflectionUtil.*;
@@ -217,8 +216,8 @@ public class EntityConfig {

final Set<String> entityFields = new HashSet<>(fieldNamesWithAnnotations(clazz, ECField.class, ECSearchable.class, ECForeignKey.class));
if (schema != null) {
final boolean hasIncludes = !empty(schema.include());
final boolean hasExcludes = !empty(schema.exclude());
final boolean hasIncludes = annotationStringArrayHasValues(schema.include());
final boolean hasExcludes = annotationStringArrayHasValues(schema.exclude());
if (!hasIncludes && !hasExcludes) {
// include all getters
entityFields.addAll(ReflectionUtil.toMap(instantiate(clazz)).keySet());


+ 3
- 1
wizard-server/src/main/java/org/cobbzilla/wizard/server/config/OpenApiConfiguration.java Ver ficheiro

@@ -8,6 +8,7 @@ import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.oas.models.servers.Server;
import lombok.Getter;
@@ -125,7 +126,8 @@ public class OpenApiConfiguration {
for (Class<?> entity : apiEntities) {
final OpenApiSchema schema = entity.getAnnotation(OpenApiSchema.class);
final EntityConfig entityConfig = entityConfigSource.getOrCreateEntityConfig(entity, schema);
oas.schema(entityConfig.example().getClass().getSimpleName(), entityConfig.openApiSchema());
final Schema<Object> s = entityConfig.openApiSchema();
oas.schema(s.getName(), s);
}
}



Carregando…
Cancelar
Guardar