Open handrews opened 1 year ago
Some updates:
oascomply.apidescription
and oascomply.oas30dialect
is being moved into a more comprehensive set of jschon
extensions in a new oascomply.oasjson
oas30dialect
is now just the dialect/vocabulary/keyword supportoascomply.apidescription
will move into an oascomply.cli
library containing code that is not needed if using oascomply
as a libraryoascomply.apidescription
will probably be just the basic flow control for carrying out the parsing/vaidating/linting process, including registering and running extensionsThe above code organization changes are making the code a lot more testable and readable.
Milestone 2 incudes cleanup, documentation, and unit testing of the code. With Milestone 1 successfully demo'd, it's clear that some code should be rearranged a bit, and unit tests written for the rearranged code.
Terminology: APID refers to API D(escription|efinition|ocument) in the (potentially) multi-document sense. An "OAS document" (probably small-d) refers to a single discrete element (file or network resource) within an OAS APID. Documentation should use "OAS APID" in most places, as there are other APID formats.
APID interface
oascomply.apid
in place ofoascomply.apidescription
), particularly in code so we don't have to change it to align with any future consensusapidescription
. This probably includes support forargparse
-based CLI options, the structure of which is a bit unusual but seems to work, and is shared between theoascomply
andoas30-schema
tools (albeit with different option names)oascomply
as a library, which should center on the APID conceptNaming Conventions and coding style
rfc3986.URIReference
,jschon.URI
,rdflib.URIRef
)black
. It will irritate me but probably be better in the long run.Error handling
Document construction and access
jschon
's suite of JSON tools (JSON
,JSONPointer
,RelativeJSONPointer
, andJSONPatch
)OasJson
class is the right approach; an alternative might be giving an extension ofjschon.JSONSchema
the notion of a schema root independent of a document rootURIs (and IRIs), [Relative] JSON Pointers, and Templates of all of these things
rfc3987
in its own module (which could be its own package)jschon
's JSON Pointer classes, put those in their own module.fragment
should a a pointer instance or stay a string and have the pointer instance be.ptr
or similarstr
is really the right ideaJSON Schema functionality
jschon
(potentially relying on unmerged upstream PRs that might change direction) to support OAS-related functionality should get its own modulejschon
-based implementation of the OAS dialects should get its own module, probably including the OAS-defined formats (although maybe they get a separate module)jschon
should get its own module (which could potentially be contributed upstream if we wanted, although our correctness vs performance balance may not be ideal for general use)oastype4jschon
module is not used and should either be removed or updated; as the vocabulary is still annotation-only, it's unclear if there's a use for an implementation module (other than to allow the vocabulary to be used in$vocabulary
with atrue
value, which might be reason enough given how trivial it is to support)apidescription
and probably generalized somewhat, in order to support future extensibility through additional annotation-driven actionsRDF Graph functionality
rdfs:label
s based on oastype should be isolated and made easy to extend and/or override; it is one of the few places where understanding of the OAS structure appears in code, and therefore needs to be kept clearly separate from the generic codetoml
serialization should go in its own module; decide how aware of OAS it should bemore tbd...