Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent json-schema output for mac vs sles11 #54

Closed
jesse8888 opened this issue Dec 9, 2014 · 1 comment
Closed

Inconsistent json-schema output for mac vs sles11 #54

jesse8888 opened this issue Dec 9, 2014 · 1 comment

Comments

@jesse8888
Copy link

I'm using jackson to generate json schema strings from POJOs with some code that looks like this:

ObjectMapper mapper = new ObjectMapper();
mapper.registerModule( new JaxbAnnotationModule() );
SchemaFactoryWrapper visitor = new SchemaFactoryWrapper();
try
{
  for (Class<?> annotatedClass : annotatedClasses)
  {
    mapper.acceptJsonFormatVisitor(annotatedClass, visitor);
    JsonSchema jsonSchema = visitor.finalSchema();
    String schemaString = mapper.writerWithDefaultPrettyPrinter()
        .writeValueAsString(jsonSchema);

When I run this code on my linux machine for some POJOs (I'll use one as a specific example) I get the incomplete schema below:

{
"type" : "object",
"id" : "urn:jsonschema:com:emc:brs:policy:msg:ds:CreateDataSourceRequest",
"properties" : {
"className" : {
"type" : "string",
"required" : true
},
"messageVersion" : {
"type" : "string",
"required" : true,
"description" : "The version of this message",
"enum" : [ "1" ]
},
"dataSource" : {
"type" : "object",
"$ref" : "urn:jsonschema:com:emc:brs:policy:msg:DataSource",
}
}
}

When my co-worker runs the exact same code on his mac, he gets the desired output schema:

{
"type" : "object",
"id" : "urn:jsonschema:com:emc:brs:policy:msg:ds:CreateDataSourceRequest",
"properties" : {
"className" : {
"type" : "string",
"required" : true
},
"messageVersion" : {
"type" : "string",
"required" : true,
"description" : "The version of this message",
"enum" : [ "1" ]
},
"dataSource" : {
"type" : "object",
"id" : "urn:jsonschema:com:emc:brs:policy:msg:DataSource",
"properties" : {
"hosts" : {
"type" : "array",
"required" : true,
"description" : "Reference to the credentials object if applicable",
"items" : {
"type" : "object",
"id" : "urn:jsonschema:com:emc:brs:policy:msg:Host",
"properties" : {
"hostname" : {
"type" : "string"
},
"ipv6Address" : {
"type" : "string"
},
"name" : {
"type" : "string",
"description" : "Optional alias or name of the object"
},
"ipv4Address" : {
"type" : "string"
},
"osType" : {
"type" : "string"
},
"attributes" : {
"type" : "object",
"description" : "List of attributes for the object",
"additionalProperties" : {
"type" : "string"
}
},
"uuid" : {
"type" : "string",
"required" : true,
"description" : "Unique id of this object"
},
"tags" : {
"type" : "object",
"description" : "List of tags for the object",
"additionalProperties" : {
"type" : "string"
}
}
}
}
},
"paths" : {
"type" : "array",
"required" : true,
"description" : "List of paths and/or compound paths to back up",
"items" : {
"type" : "string"
}
},
"name" : {
"type" : "string",
"description" : "Optional alias or name of the object"
},
"options" : {
"type" : "object",
"id" : "urn:jsonschema:com:emc:brs:policy:msg:Options",
"properties" : {
"name" : {
"type" : "string",
"description" : "Optional alias or name of the object"
},
"flags" : {
"type" : "object",
"additionalProperties" : {
"type" : "string"
}
},
"attributes" : {
"type" : "object",
"description" : "List of attributes for the object",
"additionalProperties" : {
"type" : "string"
}
},
"pid" : {
"type" : "integer"
},
"uuid" : {
"type" : "string",
"required" : true,
"description" : "Unique id of this object"
},
"version" : {
"type" : "string"
},
"tags" : {
"type" : "object",
"description" : "List of tags for the object",
"additionalProperties" : {
"type" : "string"
}
}
}
},
"attributes" : {
"type" : "object",
"description" : "List of attributes for the object",
"additionalProperties" : {
"type" : "string"
}
},
"uuid" : {
"type" : "string",
"required" : true,
"description" : "Unique id of this object"
},
"creds" : {
"type" : "object",
"$ref" : "urn:jsonschema:com:emc:brs:policy:msg:Creds"
},
"dataSourceType" : {
"type" : "string",
"required" : true,
"description" : "The type of data source",
"enum" : [ "FILE_SYSTEM", "FILE_SYSTEM_TRADITIONAL", "FILE_SYSTEM_INCREMENTAL_FOREVER", "DB2", "EXCHANGE", "HYPER_V", "INTERNAL", "LOTUS", "NAS_DEVICE", "ORACLE", "SAP", "SHAREPOINT", "SQL", "SYBASE", "VMWARE", "UNKNOWN" ]
},
"tags" : {
"type" : "object",
"description" : "List of tags for the object",
"additionalProperties" : {
"type" : "string"
}
}
}
}
}
}

I am at a loss for what could be causing this beyond some sort of nasty/inconsistent interaction between Jackson and the JVM implementations. Have you seen anything like this before? Is there anything obvious I should try as a workaround?

@jesse8888
Copy link
Author

I have built from the latest source (jackson-module-jsonSchema-2.4.5-SNAPSHOT.jar) and my issue is no longer present. It would be interesting to know why the issue wasn't present on Macs originally, but for now my issue is resolved.

I believe issue 47 was the fix

#47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant