Conversation
|
@zdne One question I have is, will there every be a situation where a source map element may need to broken apart for for multiple files? In other words, could one element be derived from two different files, requires more complex source map? Hope that makes sense. |
|
@smizell has a good question. Otherwise this is good to go for me. |
Fix typo, indentation and add clarification on using source map “unperfected”.
|
Looks good. Still need to answer the following.
|
That makes very much of the sense! Theoretically this can happen albeit I do not see it at the moment. In such a case the source map should be obviously an array. Are you suggesting the |
|
Alternatively a Something like {
"element": "sourceMap",
"attributes": {},
"content": [
{
"source": {},
"map": [[4, 12], [20, 12]]
}
]
} |
|
@smizell @pksunkara guys, I've updated the document and added some thoughts here. Please review & comment. Thanks! |
|
I like the second proposal since it is more compact, but I don't like that the content is not an element in that example |
There was a problem hiding this comment.
Could it be possible that an element might span across multiple files?
There was a problem hiding this comment.
Ah nice, sorry didn't see that. Was only looking in file view.
|
@pksunkara @smizell bump 😜 |
|
@zdne Thanks for putting up with my neglect of this :) My thought here is, you need each source map to be able to be associated with a file, but you may need to multiple files associated with a specific element. This means an element should be able to have multiple source maps. I'm not sure either proposal here addresses that. BUT if that is not a necessity short term (either too complex or premature optimizing) and you are not interested in addressing multiple files for one element, I'd vote for your proposal as it allows you to have one-to-one with source file and source map. This means you can add multiple source maps later if you want. {
"element": "...",
"attributes": {
"sourceMap": [
{
"element": "sourceMap",
"attributes": {
"contentType": "text/vnd.apiblueprint+markdown",
"href": "apiary.apib1"
},
"content": [[4, 12], [20, 12]]
},
{
"element": "sourceMap",
"attributes": {
"contentType": "text/vnd.apiblueprint+markdown",
"href": "apiary.apib2"
},
"content": [[4, 12], [20, 12]]
}
]
}
}So two things:
|
|
@smizell I like the proposal, I think we should keep both the file and the content offsets together in one element that splitting them across two. |
@smizell I am sorry but I thought @zdne's proposals above (which is the same as your example in the above comment) solves this. Maybe I am misunderstanding. Can you explain a bit where his proposal is lacking/failing? |
|
Maybe I'm reading it wrong, but his current proposal does not address multiple files. The sourceMap property in attributes is just one sourceMap element. My example has sourceMap being an array of elements. |
|
Ah thank you. I did miss that. That may be the way to go, though should it always be an array? Could it be a sourceMap element or array of sourceMap elements? Simplest is always array. Then you could change the property name as you've said. |
|
So, the current question is:
What do you think, @zdne |
|
I like the array of source maps idea. I also like the name |
|
@danielgtaylor Sounds good! Will wait on @zdne here thoughts between:
|
|
@zdne I'm ready to merge this. One thing though I want to be sure of is that you have a singular name |
|
I thought we wanted to use |
|
@smizell @pksunkara this use of singular is intentional, yes. It is a source map of the element (possibly composed of multiple source maps). I do not like the names of properties hinting the type of its values (Hungarian notation). I prefer using plural when it makes sense from semantical standpoint e.g. "items" in a shopping cart. We were discussing this with @danielgtaylor on unrelated issue about "copy" vs. "copy texts" (singular vs. plural): If you have a collection of possibly unrelated copy information then I'd suggest to use plural form but contrary to it if the property represents a copy information about the element (regardless of the fact it is composed from an object or array or whatnot) then it would be singular. Does it clarify? In other words I want to avoid following:
etc. |
|
I don't want to carry this out too long, but did want to point out a couple of things. Note: I am really fine personally either way.
I get the reasoning of not making plural, though. Proceed as you see fit. |
This is my main concern. We are using the pattern elsewhere. I have no problem in merging this currently. Either way is fine with me. |
I didn't really want to get into this here BUT I've never liked the There, the property clearly defines what a "class" of the element is. Regardless of the fact the content of it is an array of strings. All the strings together define the compound class of the element. I believe the main motivation there was not the fact to express the collection but avoid the clashes with some programming languages. As such I wasn't against it because the use of plural has a technical reasoning not semantical. |
|
@zdne Makes sense :) |
In order to support multiple files in the future we need to carry information about the source file in the source map. This RFC suggest prepare for this by changing the current definition of the Source Map element.