print correct type in json format comment
This commit is contained in:
parent
6981e75765
commit
d67f7c9926
|
@ -43,6 +43,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -65,6 +66,12 @@ public class GraphQLSchemaGenerator {
|
|||
public enum FHIROperationType {READ, SEARCH, CREATE, UPDATE, DELETE};
|
||||
|
||||
private static final String INNER_TYPE_NAME = "gql.type.name";
|
||||
private static final Set<String> JSON_NUMBER_TYPES = new HashSet<String>() {{
|
||||
add("decimal");
|
||||
add("positiveInt");
|
||||
add("unsignedInt");
|
||||
}};
|
||||
|
||||
IWorkerContext context;
|
||||
|
||||
public GraphQLSchemaGenerator(IWorkerContext context) {
|
||||
|
@ -411,7 +418,7 @@ public class GraphQLSchemaGenerator {
|
|||
if (gqlName.equals(name)) {
|
||||
writer.write("scalar ");
|
||||
writer.write(name);
|
||||
writer.write(" # JSON Format: String");
|
||||
writer.write(" # JSON Format: string");
|
||||
} else {
|
||||
writer.write("# Search Param ");
|
||||
writer.write(name);
|
||||
|
@ -426,7 +433,12 @@ public class GraphQLSchemaGenerator {
|
|||
if (!ed.getType().isEmpty() && ed.getType().get(0).getCodeElement().hasExtension("http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type"))
|
||||
return ed.getType().get(0).getCodeElement().getExtensionString("http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type");
|
||||
}
|
||||
return "??";
|
||||
// all primitives but JSON_NUMBER_TYPES are represented as JSON strings
|
||||
if (JSON_NUMBER_TYPES.contains(sd.getName())) {
|
||||
return "number";
|
||||
} else {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
||||
private String getGqlname(String name) {
|
||||
|
|
|
@ -42,6 +42,7 @@ import java.io.OutputStreamWriter;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -50,7 +51,6 @@ import java.util.Set;
|
|||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.conformance.ProfileUtilities;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.model.Constants;
|
||||
import org.hl7.fhir.r5.model.ElementDefinition;
|
||||
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
|
||||
import org.hl7.fhir.r5.model.Enumerations.SearchParamType;
|
||||
|
@ -65,6 +65,12 @@ public class GraphQLSchemaGenerator {
|
|||
public enum FHIROperationType {READ, SEARCH, CREATE, UPDATE, DELETE};
|
||||
|
||||
private static final String INNER_TYPE_NAME = "gql.type.name";
|
||||
private static final Set<String> JSON_NUMBER_TYPES = new HashSet<String>() {{
|
||||
add("decimal");
|
||||
add("positiveInt");
|
||||
add("unsignedInt");
|
||||
}};
|
||||
|
||||
IWorkerContext context;
|
||||
private ProfileUtilities profileUtilities;
|
||||
private String version;
|
||||
|
@ -415,7 +421,7 @@ public class GraphQLSchemaGenerator {
|
|||
if (gqlName.equals(name)) {
|
||||
writer.write("scalar ");
|
||||
writer.write(name);
|
||||
writer.write(" # JSON Format: String");
|
||||
writer.write(" # JSON Format: string");
|
||||
} else {
|
||||
writer.write("# Search Param ");
|
||||
writer.write(name);
|
||||
|
@ -430,7 +436,12 @@ public class GraphQLSchemaGenerator {
|
|||
if (!ed.getType().isEmpty() && ed.getType().get(0).getCodeElement().hasExtension("http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type"))
|
||||
return ed.getType().get(0).getCodeElement().getExtensionString("http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type");
|
||||
}
|
||||
return "??";
|
||||
// all primitives but JSON_NUMBER_TYPES are represented as JSON strings
|
||||
if (JSON_NUMBER_TYPES.contains(sd.getName())) {
|
||||
return "number";
|
||||
} else {
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
||||
private String getGqlname(String name) {
|
||||
|
|
Loading…
Reference in New Issue