Commit Graph

57 Commits

Author SHA1 Message Date
quobix
bf270d3d2b whacking the shit out of exploded use-cases
Before everything worked, but was completely accurate, now everything works and everything is absolute and can be resolved. Phew, what a mission!

Signed-off-by: quobix <dave@quobix.com>
2023-10-21 14:14:49 -04:00
quobix
afe89454ac More fine tuning, handling resolving and edge cases now.
Signed-off-by: quobix <dave@quobix.com>
2023-10-20 17:50:51 -04:00
quobix
1bf772ab69 All spec_index tests pass
It’s so, so much faster than before, intelligent and ready for scale. I’m excited!

Signed-off-by: quobix <dave@quobix.com>
2023-10-20 11:38:29 -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
054103b733 working through logging now and further tests
starting the circle dance now.

Signed-off-by: quobix <dave@quobix.com>
2023-10-18 17:27:56 -04:00
quobix
9ee1afe1f3 digital ocean now running correctly
Sucking in all the files!

Signed-off-by: quobix <dave@quobix.com>
2023-10-18 16:52:32 -04:00
quobix
48c83ddb30 resolver tests all operational
time to start some cleanup.

Signed-off-by: quobix <dave@quobix.com>
2023-10-18 12:01:06 -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
Nicholas Jackson
b6f5730a7f chore: replace use of deprecated ioutil with os 2023-10-08 12:23:48 -04:00
Tristan Cartledge
2723ed974d fix: test 2023-10-05 09:31:16 -04:00
Tristan Cartledge
74c7a3f632 fix: improves the ability to get all inline schemas and identify inline object schemas (#154)
* fix: improves the ability to get all inline schemas and identify inline object schemas

* fix

* fix

* fix

* fix
2023-08-22 06:40:00 -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
Tristan Cartledge
06f6b243a8 fix: add missing path and parent node to paths index references 2023-05-30 09:20:56 -04:00
Dave Shanley
08f596058f Cleaning up some tests after ancestor lookup code added.
Signed-off-by: Dave Shanley <dave@quobix.com>
2023-05-16 17:03:02 -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
581423016f Added another test to validate #88
Code is behaving correctly, according to the design.
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
4901813e88 Updated test to reflect new inline schema count
Looks like we were missing a ton!
2023-02-27 11:05:18 -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
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
1df5f44e6f Working through fix-73 and v0.6.0 2023-02-22 09:14:27 -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
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
8581c7fb45 fix: add test 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
8dff96ad90 Cleaning up some coverage and a few bits. 2022-12-15 16:31:32 -05:00
Dave Shanley
aaa7174f93 Updated test based on new cleaner path generation 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
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
fa12f244b8 Fixing borked test with index checking.
This looks like it needs a deeper look, reverting change for now.

Signed-off-by: Dave Shanley <dshanley@splunk.com>
2022-11-11 13:11:25 -05:00
Dave Shanley
44b219a023 Fixed resolving bug with polymorphic schemas.
Multiple polymorphic, deeply embedded schemas cause resolving issues as a channel waits forever due to a counting issue.

This has been resolved.

Signed-off-by: Dave Shanley <dshanley@splunk.com>
2022-11-11 13:07:38 -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
Dave Shanley
0d4e8bf3f8 Added securityRequirement reference tracking to index.
Swagger docs define securityDefinitions, however they are not tracked by the index, and vacuum needs to know about them, so now the index collects these references.
2022-10-21 17:38:39 -04:00
Dave Shanley
57622b26e5 Docs, examples and new logo! 2022-09-26 10:52:09 -04:00
Dave Shanley
5c93f3e28b Low level support for 3.1 model updates
Webhooks and dialect are now added and working.
2022-09-15 06:28:56 -04:00
Dave Shanley
d57b9ca482 Fixed borked index test 2022-09-05 13:23:12 -04:00
Dave Shanley
0de0c16c0c 99.9 % coverage & full OpenAPI v3 support
A single line that tries to read an HTTP response body and fails is very hard to test without mocking, and the mock does not add value to a single line of code to check for an error that can rarely ever be triggered. Going to settle for 99.9% for now.
2022-08-31 10:04:39 -04:00
Dave Shanley
62a7c88631 Bumping coverage on spec index.
cleaning up the left-over untested code from recent development.
2022-08-30 10:05:48 -04:00
Dave Shanley
081fc9be56 Bumping coverage across high level model
fixing small glitches as the model is tested. we're almost there! it's almost ready!
2022-08-24 11:26:39 -04:00
Dave Shanley
5d07da52b1 Fixed resolver to correctly identify polymorphic circular references.
Both stripe and k8s are correctly identified now.
2022-08-23 14:57:32 -04:00
Dave Shanley
0fd825aef8 High level model build is currently fast as lightning.
little refactoring to keep things all clean and in place.
2022-08-18 10:39:47 -04:00
Dave Shanley
1c9f6bbfcc adding tests, fixing bugs, validating model.
Amazing what you find when you really test the fuck out of things.
2022-08-14 08:18:27 -04:00
Dave Shanley
51c4d08b5a Another pipeline error
fixed I hope!
2022-08-12 07:22:43 -04:00
Dave Shanley
a8623ceec4 Test is borked in pipeline, works fine locally.
trying to play whack-a-mole now to determine the failures.
2022-08-12 07:04:20 -04:00
Dave Shanley
248b4daa80 We-worked model to remove resolver.
lookups are performed inline now. keeps things simpler, however it has a performance knock, so it's time to refine async building were possible.
2022-08-11 14:54:25 -04:00