@@ -87,6 +87,8 @@ def upload_and_generate_schema_list(
8787 s3_client = boto3 .client ("s3" )
8888 all_schema_flights_with_length_serialized : list [Any ] = []
8989
90+ external_details : dict [str , Any ] = {}
91+
9092 for catalog_name , schema_names in flight_inventory .items ():
9193 for schema_name , schema_items in schema_names .items ():
9294 # Serialize all of the FlightInfo into an array.
@@ -115,13 +117,22 @@ def upload_and_generate_schema_list(
115117 ]
116118 )
117119
120+ external_details = {}
121+ if not serialize_inline :
122+ external_details = {
123+ "external" : {
124+ "url" : schema_path ,
125+ }
126+ }
127+ if enable_sha256_caching :
128+ external_details ["external" ]["sha256" ] = uploaded_schema_contents .sha256_hash
129+
118130 serialized_schema_data .append (
119131 {
120132 "schema" : schema_name ,
121133 "description" : schema_details [schema_name ].description if schema_name in schema_details else "" ,
122134 "contents" : {
123- "url" : schema_path if not serialize_inline else None ,
124- "sha256" : uploaded_schema_contents .sha256_hash if enable_sha256_caching else None ,
135+ ** external_details ,
125136 "serialized" : None ,
126137 },
127138 "tags" : schema_details [schema_name ].tags if schema_name in schema_details else {},
@@ -139,12 +150,21 @@ def upload_and_generate_schema_list(
139150 )
140151 all_schema_path = f"{ SCHEMA_BASE_URL } /{ all_schema_contents_upload .s3_path } "
141152
153+ external_details = {}
154+ if not serialize_inline :
155+ external_details = {
156+ "external" : {
157+ "url" : all_schema_path ,
158+ }
159+ }
160+ if enable_sha256_caching :
161+ external_details ["external" ]["sha256" ] = all_schema_contents_upload .sha256_hash
162+
142163 schemas_list_data = {
143164 "schemas" : serialized_schema_data ,
144165 # This encodes the contents of all schemas in one file.
145166 "contents" : {
146- "url" : all_schema_path if not serialize_inline else None ,
147- "sha256" : all_schema_contents_upload .sha256_hash if enable_sha256_caching else None ,
167+ ** external_details ,
148168 "serialized" : all_schema_contents_upload .compressed_data if serialize_inline else None ,
149169 },
150170 }
0 commit comments