Commit Graph

17 Commits

Author SHA1 Message Date
zak905
29a44e405a path unescape url when resolving remote reference 2023-07-28 16:42:31 -04:00
Dave Shanley
25d8de9b0e Added more support for YAML merge nodes, anchors and aliases
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>
2023-07-16 11:45:18 -04:00
Dave Shanley
3b7cbacc44 Add support for custom io.FS remote handler in index #85
A new configuration option is available to the index, a `RemoteHandler` of type  `fs.FS`. If set, will be used as an override to all other remote fetching code.

Signed-off-by: Dave Shanley <dave@quobix.com>
2023-07-16 11:45:18 -04:00
Federico Bevione
572130c666 add test, fix RemoteURLHandler field name 2023-06-30 13:24:16 -04:00
Federico Bevione
0c0399abbe expose optional function to resolve remote files 2023-06-30 13:24:16 -04:00
Dave Shanley
f629c0ff58 fix for resolving looping relative references
In vacuum, a usecase was reported where an infinite loop occurred due to re-parsing the same reference over and over in a loop. It was re-creatable and it was because the loop happened before the index was ready.

This should be resolved now, at least for this use case. To be sure, I have included the specs as a new test.

https://github.com/daveshanley/vacuum/issues/268
Signed-off-by: Dave Shanley <dave@quobix.com>
2023-05-16 17:03:02 -04:00
Dave Shanley
eec0c71092 Added some URL checking to index URL extraction.
In the case of relative files, the first arg won’t be a URL, so this ensures both relatitve and full references work.
2023-04-22 09:50:44 -04:00
Dave Shanley
24d094ca7b Corrected remote document lookup behavior
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)
2023-04-22 09:50:44 -04:00
Dave Shanley
cb5f2da4d3 Fixed race conditions in index #91
Different race conditions popped up at different times, depending on how complex the nesting of indexes was. After running tests with `-race` I've knocked out all the concurrency issues being reported and now there are no race conditions reported by the tests. This should knock out all known race conditions with some targeted mutex locks.

Non breaking change.
2023-03-08 09:26:10 -05:00
Dave Shanley
b72c1fce40 Cleaned up a few lines
review looked a bit gappy.
2023-03-06 13:18:28 -05:00
Dave Shanley
0f2ac08567 Fixed async isues with index #91
The index runs async everywhere, it's kinda impossible to know which path with resolve first, so testing is hard. Sometimes a race condition is hit, well, it was. Now that map has a mutex on it.

Also fully fixed handling files with relative links. A basepath property has been added to the index configuration to allow a local root to be set when resolving files.

Added a full checkout test for digital ocean so that full remote and full local testing is performed.
2023-03-06 13:18:28 -05:00
Dave Shanley
5481353994 removed error check on unescape. nothing to be done. 2023-02-22 09:14:27 -05:00
Dave Shanley
d8a7b6c21d Ensure encoded paths are handled in lookup. #84
This partially resolves a whacky path ref lookup in the index mentioned in #84, but it's not a full fix, that requires the build out of a resolved spec. The design needs thought and care.
2023-02-22 09:14:27 -05:00
Dave Shanley
c5e9dbc360 Bumping coverage on 0.6.0 2023-02-22 09:14:27 -05:00
Dave Shanley
e6626fe22e Support for relative links now in place #73
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.
2023-02-22 09:14:27 -05:00
Dave Shanley
e19b7d2bf1 Working through fix #73
Quite a bit of surgery required.
2023-02-22 09:14:27 -05:00
Dave Shanley
1df5f44e6f Working through fix-73 and v0.6.0 2023-02-22 09:14:27 -05:00