And added deeper support for Aliases. Also added in local file handling through renamed `FSHandler` configuration property for the index.
Also re-ran `go fmt`
Signed-off-by: Dave Shanley <dave@quobix.com>
Now the original indention is captured and string delimiters are retained when rendering out documents.
Signed-off-by: Dave Shanley <dave@quobix.com>
# fixes 106
Original input document types are now rendered automatically as JSON or YAML (vs always being YAML). This only operates at the `Document` level for rendering out entire documents.
Requested in #105
Signed-off-by: Dave Shanley <dave@quobix.com>
When remote documents are requested and there is no way to know the base URL, the index will now try and determine the base path from the way the spec was loaded (if it comes in remote, we use the base URL of the spec)
some ref handling was a bit strange, now it's rendering correctly. I have a feeling we will be back to the diff engine at some point soon, it's picking up some strange changes that are so deep in the model, I can't determine what is what, so we will wait for another set of triggers to appear.
however, more hardening is required, Asana is getting upset with changes found when rendering, so that's up next. Then, we will need to harden against few others.
Tests all passing, runs super fast, pulls in every single DigitalOcean spec and parses it. There may be some issues deeper down in the models, but for now high level tests all pass.
The more in-depth we use extensions, the more likely is is that we need custom extensions. New `UnpackExtensions` function in the high package makes this easy. Low level models have been updated to support feature fully and docs added in README and examples as well.
Signed-off-by: Dave Shanley <dave@quobix.com>
Thinking more about how to know what to resolve and what not to means depending on circular reference knowledge. So using an idea from @TristanSpeakEasy, the `*resolver.ResolvingError` now contains a pointer to the original circular error, and it also implements the `Error` interface correctly which allows it simple passage up the chain, without losing fidelity.
Added new documentation example as well
Signed-off-by: Dave Shanley <dave@quobix.com>
Tristan made a good point, part of the doc building process performs a resolving check and circular reference check, which is ignored by the returned errors. So resolving errors are now unpacked into standard errors and returned. Not sure why gofmt has shifted everything around however.
When paths are wrapped in an array, the index throws an error because it's expecting them to be supplied as a map. Now paths can be wrapped or unwrapped, the index won't care.
This simple method gives the low API a super powerful and simple way to mutate the value of any node, which is then reflected in the root node, can than be serialized again and, voila! now our spec is editable.