Commit Graph

60 Commits

Author SHA1 Message Date
Tristan Cartledge
161a41f73b chore: update to use iterators on orderedmaps 2024-08-26 20:42:40 +01:00
quobix
527d3cdc81 more ye olde time coverage for ye tests. 2024-08-05 09:29:07 -04:00
quobix
631e4a8478 Improving coverage 2024-08-05 09:29:07 -04:00
quobix
70f406b6cf Added NodeMap to all low level objects.
this sync map tracks all the nodes that apply to this object.
2024-08-05 09:29:07 -04:00
quobix
93c5b25d6c Added GetRootNode() and GetKeyNode methods to low model. 2024-07-08 10:14:32 -04:00
quobix
56cb1c8694 more cleanup and coverage
Signed-off-by: quobix <dave@quobix.com>
2024-02-20 13:34:39 -05:00
quobix
2f82a69d6c A clean sweep around resolving during model builds.
Really hammering on this model using all available examples of crazy references used in crazy ways. The fixes mean I can delete the recent patch added to handle lost indexes.

I spent two days on this commit.

Signed-off-by: quobix <dave@quobix.com>
2024-02-20 13:34:39 -05:00
quobix
5ea4f2b762 Fixed last known lookup bug
All known gaps (well known in my own head) seem to have been closed now, the final TODO in this area has been cleaned up, highlighted by an issue reported by speakeasy.

Signed-off-by: quobix <dave@quobix.com>
2024-02-13 07:33:55 -05:00
quobix
974c7bbf49 Fixed issue reported in discord channel
Building out a model, the current position was getting a bit muddled with deeply nested file references.

Signed-off-by: quobix <dave@quobix.com>
2024-02-13 07:33:55 -05:00
quobix
7afb1e9d11 Addressed #159
Cleaned up all interesting static checks. All that is left is cosmetics.

Signed-off-by: quobix <dave@quobix.com>
2024-02-06 22:13:41 -05:00
quobix
63354654bf added in keynode support
soemthing that has been waiting to be filled in for some time.

Signed-off-by: quobix <dave@quobix.com>
2024-01-04 17:08:08 -05:00
quobix
9cf06d3986 Fixed glitch reported by #219
Context was not being carried through correctly when resolving using `Schema()` and using exploded files.

Signed-off-by: quobix <dave@quobix.com>
2023-12-18 09:51:18 -05:00
Tristan Cartledge
137db075d8 fix: for all tests 2023-12-02 16:16:40 +00:00
Tristan Cartledge
a4ad09aab3 fix: continued moving everything to orderedmaps plus cleaned up most the tests 2023-12-01 17:37:07 +00:00
Tristan Cartledge
785824a271 fix: fixed tests after merge 2023-11-27 17:05:37 +00:00
Tristan Cartledge
2de65e4ca0 Merge branch 'main' into Baliedge/PIP-2552-consistent-ordering 2023-11-27 12:06:39 +00:00
quobix
745142d9e0 Fixed logic and test failure
Signed-off-by: quobix <dave@quobix.com>
2023-11-17 16:44:01 -05:00
quobix
af5cb775aa Stop the remote FS from looking up local files
added [empty] to represent literally empty refs

Signed-off-by: quobix <dave@quobix.com>
2023-11-17 16:44:01 -05:00
quobix
fde5a9972d tuning ref lookups, finding some gaps.
coverage will drop no doubt

Signed-off-by: quobix <dave@quobix.com>
2023-11-03 14:06:37 -04:00
quobix
a8a0e1d47f added context to schema buildout
model was failing on subschemas with refs, needed context

Signed-off-by: quobix <dave@quobix.com>
2023-11-02 10:47:31 -04: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
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
70eda75790 Schema now has access to index, which has access to spec info.
version can be extracted from anywhere in the model.  Added logic for extracting the correct
version for exlusiveMaximum and exlusiveMinimum

Signed-off-by: quobix <dave@quobix.com>
2023-10-08 12:27:52 -04:00
Tristan Cartledge
8531113e17 fix!: fixed handling of additionalProperties to handle the bool/json-schema nature better 2023-10-05 09:31:16 -04:00
Shawn Poulson
f389fedadd Monster refactor of map to orderedmap.Map data type. 2023-09-25 08:59:42 -04:00
Tristan Cartledge
58433a6ffc fix: add missing const value to schema 2023-09-13 06:13:09 -04:00
Dmitry
55da120b19 Add dummy parameter to conform to Buildable 2023-08-25 09:51:57 -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
c3cf5f1e38 Added support for unevaluatedProperties as Schema and bool #118
Also ran `gofmt` across the entire project. Things need cleaning up.

Signed-off-by: Dave Shanley <dave@quobix.com>
2023-06-17 14:12:27 -04:00
Derrick J. Wippler
a09916eb67 fix: Schema.Minimum and Schema.Maxmium are now float64 2023-06-17 13:12:50 -04:00
Dave Shanley
26e694a5e9 Updated embedded OAS schemas and fixed UniqueValues
UniqueValues was marked as an integer, not a boolean.

Signed-off-by: Dave Shanley <dave@quobix.com>
2023-04-30 09:01:15 -04:00
Tristan Cartledge
99bf12c1c7 feat: add attribute to schema model 2023-04-18 05:22:49 -04:00
Dave Shanley
04eac2abe7 More hardening with digitla ocean
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.
2023-03-26 06:10:31 -04:00
Dave Shanley
0e8ae7c548 rendering complex additionalProperties in place.
slices of maps were not rendered properly. Now corrected, coverage continues to rise, refactoring node generation into utils package.
2023-03-26 06:10:31 -04:00
Dave Shanley
0b8fab869e working through code coverage 2023-03-26 06:10:31 -04:00
Dave Shanley
3101a7c9b7 Large update to support v3 rendering. 2023-03-26 06:10:31 -04:00
Dave Shanley
38064123ed Working through complex rendering edgecases. 2023-03-26 06:10:31 -04:00
Dave Shanley
bf4e94bcbd fix: swapped line/col for issue #86
Swapped line and col in error.
2023-02-27 11:05:18 -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
Dmitry
cc5b7e73d9 Fix ref object parsing 2023-01-12 17:36:38 -05:00
Tristan Cartledge
52f9868d96 fix: fix handling of ordered arrays when processing them async 2023-01-10 17:39:03 -05:00
Dave Shanley
3fd088b217 Increased coverage for model back to 100% 2022-12-09 07:06:34 -05:00
Dave Shanley
b3f0a0b1ae Working on model changes to resolve #38 and #28 **breaking change**
Also adding in other properties to schema that are missing. Test coverage still needs improving and this is a breaking change to low and high models.
2022-12-09 07:06:34 -05:00
Dave Shanley
d51d2fcd27 Added contains, minContains and maxContains to schema #28
Added support for missing 3.1 schema properties, however it does not cover the `boolean` case
2022-12-09 07:06:34 -05:00
Dave Shanley
cbfb051a92 (feat): Schema now has pointer back to SchemaProxy #29
The 'owning' `SchemaProxy` is now trackable back from a `Schema` part of the conversations happening on #29
2022-12-05 12:18:10 -05:00
Dave Shanley
c08dd591b2 (feat): Unpack extensions into complex function types #8
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>
2022-12-02 11:15:44 -05:00
Dave Shanley
c4b6e68197 Added prefixItems support to Schema. Fixes #2
prefixItems is a property of JSONSchema and supported by OpenAPI 3.1, this update adds support for `prefixItems` in low and high models. It's essentially a copy of the `items` property, but allows seperate configuration of both, without combining them and muddling things for clarity.

Signed-off-by: Dave Shanley <dave@quobix.com>
2022-11-21 09:44:51 -05:00
Dave Shanley
26d3535e75 Working through what-changed fixes and tuneups.
more testing is required, however things feel quite reasonable and rounded. All changes correctly detected in a spec so far.
2022-11-20 14:30:50 -05:00
Dave Shanley
9d8d6e36ea what-changed operational
the code is working, the tests are passing. There is a lot more to check, but it's a good time to bring the feature into main.
2022-11-18 11:00:34 -05:00
Dave Shanley
61f99b8fd6 Replacing extensions hash code **breaking change**
This is a large update, I realized that extensions are not being hashed correctly, and because I have the same code everywhere, it means running back through the stack and cleaning up the invalid code that will break if multiple extensions are used in different positions in the raw spec.

At the same time, I realized that the v2 model has the same primitive/enum issues that are part cleaned up in v3. This is a breaking changhe because enums are now []any and not []string, as well as primitives for bool, int etc are all pointers now instead of the copied values.

This will break any consumers.
2022-11-18 11:00:34 -05:00