Commit Graph

68 Commits

Author SHA1 Message Date
quobix
cbdaac7374 cleaned up path handling a little
Signed-off-by: quobix <dave@quobix.com>
2024-01-04 17:08:08 -05:00
Tristan Cartledge
53f342ba63 fix 2023-12-06 14:54:55 +00:00
Tristan Cartledge
367b64d6db fix 2023-12-06 14:36:24 +00:00
Tristan Cartledge
2b128cb465 fix: data race 2023-12-04 18:08:02 +00:00
quobix
ee2783e6e7 more coverage bumps
Signed-off-by: quobix <dave@quobix.com>
2023-11-25 10:10:51 -05:00
quobix
44204b595e nailing down pipeline failure
can’t be reproduced locally

Signed-off-by: quobix <dave@quobix.com>
2023-11-25 10:10:51 -05:00
quobix
7d63fe3262 Added new node map capability
Signed-off-by: quobix <dave@quobix.com>
2023-11-25 10:10:51 -05:00
quobix
8bbb022daa Addressed comments from review and fixed bug with schema props
props did not have context, therefore they had no idea where they were or where to resolve from.

Signed-off-by: quobix <dave@quobix.com>
2023-11-02 10:28:29 -04:00
quobix
760a76c7dc formatted spec index.
Signed-off-by: quobix <dave@quobix.com>
2023-11-01 14:30:32 -04:00
quobix
276c3959fd Changed remote loader to use a timeout
rather than a hard block, it will wait 50ms then try again, regardless of cores, so it won’t ever block fully.

Signed-off-by: quobix <dave@quobix.com>
2023-11-01 14:29:52 -04:00
quobix
2bc3c67776 Removed some dead code that does not need to exist
A consequence of the old index design, now gone

Signed-off-by: quobix <dave@quobix.com>
2023-11-01 13:07:53 -04:00
quobix
3c27c43ec0 Added cache set/get for index
It’s required to be able to ensire full coverage to test things that can’t be tested without a huge amount of test rigging.

Signed-off-by: quobix <dave@quobix.com>
2023-11-01 11:38:16 -04:00
quobix
6e9db7f838 A massive test update to bring everything inlne with the new Buildable signature.
All tests in index and datamodel now pass. The rolodex fixes all the things.

Signed-off-by: quobix <dave@quobix.com>
2023-10-23 18:18:44 -04:00
quobix
8717b3cd33 An enormous amount of surgery on the low level model.
Every `Build()` method now requires a `context.Context`. This is so the rolodex knows where to resolve from when locating relative links. Without knowing where we are, there is no way to resolve anything. This new mechanism allows the model to recurse across as many files as required to locate references, without loosing track of where we are in the process.

Signed-off-by: quobix <dave@quobix.com>
2023-10-23 15:04:34 -04:00
quobix
3bf830c2b3 Another round of cleaning.
Signed-off-by: quobix <dave@quobix.com>
2023-10-21 18:41:53 -04:00
quobix
28047d08d2 First sweep at cleaning up dead code
first round of a number I am sure, lots to clean.

Signed-off-by: quobix <dave@quobix.com>
2023-10-21 18:26:21 -04:00
quobix
b295e8fd5c bashing through usecases and updating tests as we go.
so many things that can go wrong. have to catch them all.

Signed-off-by: quobix <dave@quobix.com>
2023-10-19 15:18:33 -04:00
quobix
51971762a9 Another massive surgical strike with the rolodex and index reshuffle.
Signed-off-by: quobix <dave@quobix.com>
2023-10-18 09:29:26 -04:00
quobix
511843e4df Major surgery on the index and resolver. A complete flip in design.
Signed-off-by: quobix <dave@quobix.com>
2023-10-14 12:36:38 -04:00
Dave Shanley
976ca0905a Added line sorting back in for GetAllSchemas
Signed-off-by: Dave Shanley <dave@quobix.com>
2023-08-09 07:40:24 -04:00
Dave Shanley
f7ab737f0a Updated index to count schemas, even if they are refs.
This was brought up in chat, that the expectation is that all schemas are included, refs or not. This update fixes that for the index and adds in a new individual property to count just the references `GetAllReferenceSchemas `

Signed-off-by: Dave Shanley <dave@quobix.com>
2023-08-09 07:40:24 -04:00
Dave Shanley
a4b7a01c43 Extracting index building code to be run optionally
This is to allow the correct operation of local/remote lookups to be correctly indexed (after the resolver has run). Addresses an issue in vacuum https://github.com/daveshanley/vacuum/issues/294

Signed-off-by: Dave Shanley <dave@quobix.com>
2023-06-17 14:12:27 -04:00
Tristan Cartledge
06f6b243a8 fix: add missing path and parent node to paths index references 2023-05-30 09:20:56 -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
3544ed0303 Churning through v3 models now.
mutations everywhere, for everyone!
2023-03-26 06:10:31 -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
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
bc1d8c5454 fix: Issue #82
The index can now accept multiple parameters with the same name, as long as they have different `in` types.
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
Dave Shanley
545dbc88c4 fix: panic when schema used as non-label #76
a small oversight in 0.5.0 means that using a `schema` anywhere other than a label, caused the index to get upset. This has now been resolved.
2023-02-02 05:22:56 -05:00
Dave Shanley
6d77716c9a feat: add index for getting all "schema" objects #50
There is new code that looks for inline `schema` definitions and collects them, as well as a futher subset of references that are specifically `object` or `array` types. This is a breaking change because the `index.GetAllSchemas()` method now returns a slice of *Reference pointers, rather than a map of them. The original behavior of `GetAllSchemas()` has been replaced with `GetAllComponentSchemas()` which retains the signature.

Two new additional methods `GetAllInlineSchemas()` and `GetAllInlineSchemaObjects()`. The former will return everything in the spec marked with `schema` that is not a reference. The latter will return everything the former does, except filtered down by `object` or `array` types.

Also the index is now bubbled up through the document model. There isn't a simple way to get access to it, small non breaking change that attaches a reference to the index, returned by `DocumentModel`
2023-01-28 14:09:11 -05:00
Benjamin Nolan (TwoWholeWorms)
cd63f66efe fix: Check for direct reference in IsPropertyNodeRequired 2023-01-11 05:47:06 -05:00
Benjamin Nolan (TwoWholeWorms)
1f2709fef3 fix: Handle direct reference loops as required 2023-01-11 05:47:06 -05:00
Benjamin Nolan (TwoWholeWorms)
7338a614d0 refactor: FindKeyNode -> FindKeyNodeTop 2023-01-11 05:47:06 -05:00
Benjamin Nolan (TwoWholeWorms)
ee504c543a feat: Allow circular references when the properties are not marked as required 2023-01-11 05:47:06 -05:00
Dave Shanley
6b28e414bd fix: Index incorrectly handling file references on the local file system.
This was reported in https://github.com/daveshanley/vacuum/issues/225, it's a continuation of the issue found in https://github.com/pb33f/libopenapi/issues/37. This fix allows the full import of the file (not just a path/component) to be imported.

Signed-off-by: Dave Shanley <dave@quobix.com>
2023-01-04 06:47:48 -05:00
Tristan Cartledge
36f5999d66 feat: add an index for object schemas with properties and add additional info to enum reference 2022-12-20 16:43:43 -05:00
Tristan Cartledge
c75a1bfaf4 fix: add paths/parent nodes to schemas as well 2022-12-16 16:09:59 -05:00
Tristan Cartledge
53789cbc1b feat: add parent nodes and paths to server index references 2022-12-16 16:09:59 -05:00
Dave Shanley
27001e083b Small glitches for vacuum.
A couple of slight bugs were causing big issues in vacuum.
2022-12-16 13:40:18 -05:00
Dave Shanley
635877da1d Small cleanup on some commented code. 2022-12-15 16:31:32 -05:00
Dave Shanley
32f48385f2 (enhancement): Improved resolving/lookup code for #45 2022-12-15 16:31:32 -05:00
Tristan Cartledge
48467b60d7 fix: didn't remove setting map before checking 2022-12-15 15:11:28 -05:00
Tristan Cartledge
09fcf334b6 fix: call out duplicate reference in parameters list 2022-12-15 15:11:28 -05:00
Tristan Cartledge
d7b9ded8bb feat: add path to references and parameters 2022-12-15 15:11:28 -05:00
Dave Shanley
05eb4ffec9 (patch): Some crazy references are causing panics. #48 #45
This patch bumps up support for creating valid JSON paths from references. It addresses #48 and makes invalid specs, valid! This addresses issues #48 and #45 that report references cannot be found. Now `libopenapi` can support much more funky lookups.
2022-12-15 09:47:23 -05:00
Dave Shanley
9ccd3bc8b7 (fix): Remote references with no components now supported by index #37
If a remote reference is used that does not contain a component ID (http://something.com/somefile.json#/components/something). The index would throw an error. This is not the correct behavior as the raw file can be the root, thus no componentID is required.

The bulk of the code is expecting that componentID, so this fix will prepare any component-less remote reference, to be treated properly.

Signed-off-by: Dave Shanley <dave@quobix.com>
2022-12-05 09:18:44 -05:00
Dave Shanley
1c98ae170a fix: panic thrown when paths is wrapped in an array #4
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.
2022-11-07 08:09:22 -05:00