hackolade / plugins

Registry for plugin repos to NoSQL document databases leveraging the Hackolade data modeling engine

Home Page:http://hackolade.com/download.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Designate a custom property as pertaining to a reference, not a definition (or both)

jdimeo opened this issue · comments

I've defined a "group" custom property, but was surprised to see that the [+] button for it was disabled for a reference. But this is exactly when a custom property is most helpful- to provide (in my case) the code generator hints on how one reference is different from another while still reusing the definition itself. Is it possible to make custom properties available to references? I see this idea is already fleshed out somewhat with the built-in "Description" vs. "Reference description".

Totally unrelated, but I've built out a bunch of (Java) code that allows you to specify your custom properties as annotated Java classes like this:

@Data
class SourceSystemMap implements CustomProperties {
	public static final String KEYWORD = "sourceSystemMapping";
	
	@Doc(displayName = "Source System",
	     value       = "The source system for this mapping.")
	private SourceSystem sourceSystemId;
	
	@JsonProperty("$comment")
	@Doc(name        = "$comment",
	     displayName = "Comments",
		 value       = "Any comments about this mapping that you want to appear in generated source code.")
	private String comment;
}

@Data @EqualsAndHashCode(callSuper = true)
class FieldSourceSystemMap extends SourceSystemMap {
	@Doc(displayName = "Attribute",
	     value       = "The attribute (usually column in SQL databases) in the source system. This may need to be fully qualified if it originates from an ancillary (joined) entity.")
	private String qualifiedAttributeName;
	
	@Doc(displayName = "Recode Values",
	     value       = "Translate values in the source system to canonical (or standardized) values in the model.")		
	private ValueSourceSystemMaps recode = new ValueSourceSystemMaps();
}

and then a tool that will automatically export all the relevant .json files using reflection to customize the plugin, for e.g.:

log.info("Writing field-level custom properties...");
write(props.resolve("field_level").resolve("fieldLevelConfig.json"), FIELDS);

image

which means that any models or schemas with these properties can be directly read back in using the same classes that define the plugin behavior themselves. Happy to discuss and demo further if this is of interest.

surprised to see that the [+] button for it was disabled for a reference. But this is exactly when a custom property is most helpful

The nominal use case for properties of a definition is such that users should not have the ability to change properties. The concept of 'Reference description" is to supplement existing properties, not to modify them.

That being said, I can see the value of the use case you describe, so we'll add this to the backlog and discuss with the team how to best support it.

I would love to see the creative ways in which you use our application. Let's do a session online. Please pick a slot at your convenience in my calendar at https://c.x.ai/pdesmarets

The developers reminded me that our plugin syntax allows the option below, as documented:
enableForReference (boolean) - optional: by default, properties of references to a definition (local, model or external) are typically disabled. By setting this to true, the property is enabled for editing, e.g. required.

Example:
image

Please note one caveat: when forward-engineering JSON Schema, if you choose to "Resolve definitions", the values in your definition will be used instead of the values in the references. If however you choose "Referenced definitions", you will get the values in the references for your customer properties.

Thank you @pdesmarets ! This is very helpful- I missed that in the docs (and it wasn't in the sample JSON files) but I'm very glad this already exists. I'm now experimenting with it.

I've grabbed a spot on your calendar tomorrow - looking forward to meeting you!