stevedlawrence commented on code in PR #1065:
URL: https://github.com/apache/daffodil/pull/1065#discussion_r1496417269


##########
daffodil-core/src/main/scala/org/apache/daffodil/core/compiler/Compiler.scala:
##########
@@ -325,7 +325,7 @@ class Compiler private (
     optRootName: Option[String] = None,
     optRootNamespace: Option[String] = None,
   ): ProcessorFactory = {
-    val source = URISchemaSource(file.toURI)
+    val source = URISchemaSource((file.getPath, file.toURI))

Review Comment:
   I guess maybe it adds an extra level in indirection without much gain? For 
example, if `URISchemaSource` looked like this:
   ```scala
   class URISchemaSource(val schemaOption)
   ```
   Then to create it you need to create a separate object, e.g.
   ```scala
   val schemaOption = new SchemaOption(..., ...)
   val schemaSource = new URISchemaSource(schemaOption)
   ```
   
   And then either everything needs to be changed to do 
`schemaSource.schemaOption.uri` for example, or `URISchemaSource` needs to 
update its members to reach into `schemaOption` for he uri and diagnostics.
   
   Really, the only reason why we need `SchemaOption` is because scallop 
doesn't have a way to access to the original CLI argument after it's been 
converted. So you either need the a tuple (or a new object that's basically a 
tuple) to keep the original string around. Nothing else in the code really 
needs this pair of diagnostic  + uri separately/ And that's really all the 
URISchemaSource it's, it's a tuple of the URI and how to show that URI in 
diagnostics plus some helper stuff.
   
   Which makes me wonder if instead of creating a `URI` in the 
`fileResourceURIConverter`, we should just create a `URISchemaSource` directly. 
I imagine everything that uses the `schema` option as a `URI` just creates a 
`URISchemaSource` anyways. And if it needs the `URI`, it can just access the 
`uri` member of the `URISchemaSource`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to