88
99require "rake/tasklib"
1010require "elastic_graph/schema_artifacts/runtime_metadata/schema_element_names"
11+ require "elastic_graph/schema_definition/extension_module_support"
1112
1213module ElasticGraph
1314 module SchemaDefinition
@@ -41,12 +42,8 @@ class RakeTasks < ::Rake::TaskLib
4142 # specific enum types. For example, to rename the `DayOfWeek.MONDAY` enum to `DayOfWeek.MON`, pass `{DayOfWeek: {MONDAY: "MON"}}`.
4243 # @param extension_modules [Array<Module>] List of Ruby modules to extend onto the `SchemaDefinition::API` instance. Designed to
4344 # support ElasticGraph extension gems (such as `elasticgraph-apollo`).
44- # @param enforce_json_schema_version [Boolean] Whether or not to enforce the requirement that the JSON schema version is incremented
45- # every time dumping the JSON schemas results in a changed artifact. Generally speaking, you will want this to be `true` for any
46- # ElasticGraph application that is in production as the versioning of JSON schemas is what supports safe schema evolution as it
47- # allows ElasticGraph to identify which version of the JSON schema the publishing system was operating on when it published an
48- # event. It can be useful to set it to `false` before your application is in production, as you do not want to be forced to bump
49- # the version after every single schema change while you are building an initial prototype.
45+ # @param extension_artifact_options [Hash<Symbol, Object>] Hash of options forwarded to extension-defined schema artifacts. The JSON
46+ # schema artifact dumper reads `:enforce_json_schema_version` from this hash; extension gems can read their own keys.
5047 # @param output [IO] used for printing task output
5148 #
5249 # @example Minimal setup with defaults
@@ -116,8 +113,8 @@ def initialize(
116113 derived_type_name_formats : { } ,
117114 type_name_overrides : { } ,
118115 enum_value_overrides_by_type : { } ,
119- extension_modules : [ ] ,
120- enforce_json_schema_version : true ,
116+ extension_modules : ExtensionModuleSupport . default_extension_modules ,
117+ extension_artifact_options : { } ,
121118 output : $stdout
122119 )
123120 @schema_element_names = SchemaArtifacts ::RuntimeMetadata ::SchemaElementNames . new (
@@ -131,7 +128,7 @@ def initialize(
131128 @index_document_sizes = index_document_sizes
132129 @path_to_schema = path_to_schema
133130 @schema_artifacts_directory = schema_artifacts_directory
134- @enforce_json_schema_version = enforce_json_schema_version
131+ @extension_artifact_options = extension_artifact_options
135132 @extension_modules = extension_modules
136133 @output = output
137134
@@ -164,7 +161,7 @@ def schema_artifact_manager
164161 schema_def_api . factory . new_schema_artifact_manager (
165162 schema_definition_results : schema_def_api . results ,
166163 schema_artifacts_directory : @schema_artifacts_directory . to_s ,
167- enforce_json_schema_version : @enforce_json_schema_version ,
164+ extension_artifact_options : @extension_artifact_options ,
168165 output : @output ,
169166 max_diff_lines : max_diff_lines
170167 )
0 commit comments