Big thoughts for 4.0 #90
Replies: 39 comments 99 replies
-
Bear with me on this one as it is not a change to the OAS per se, but a potential change in the way the spec or what may become specs (or types of extensions) are organized. It’s groundhog day for me with this recurring lifecycle of the evolution of specs and languages from simple, to addressing more complex but needed capabilities, to “the spec is too complex and hard to understand, let’s start over”. I started in 360 assembler and 6 bit line protocols (P1024B to be specific) and everything since. Yes, some fundamental changes since then like moving away from SMP and procedural compute models to the current forms of shared nothing which has been huge value. But so many mistakes repeated again and again. I will also note that I view things more from an IT leader managing thousands of developers on hundreds of projects. The real world needs to run a successful and profitable IT shop. The need for velocity and predictability of outcome (quality, function, time to market, etc.). Specs are used by developers to solve a point problem. Standards are enforced by IT leaders when they lead to real business value. One of those concerns is watching increasing use of schema as a programming language. Embedded business logic in what was intended to be CRUD messages to a discreet business object. This has always happened before hence nothing new, however it leads to a lot of instability, complexity and cost. Note that I am not suggesting we start taking things out of the spec to avoid improper or at least unadvisable use. My suggested change is in what we can do to help the community not shoot themselves in the foot quite so easily. In programming languages we are all used to the migration to higher level languages. The benefit being providing a format where average developers can express the business functions needed and let a complier produce the runtime. There was always the ability to drop back into a lower level language for edge cases. There are tools out there doing this or at least moving towards the same for schema. I said schema instead of JSON or anything specific as hopefully the tools are not tightly bound to any one instance of a format. My change is for OAI to overtly support this trend. Attack simplification by helping any tool provider coming up with a better way for developers to describe the 90% of the business needs at the API level and get developers away from manually updating schema. Compliers and similar approaches can do a lot better at leveraging the OAS to meet business needs with a lot fewer mistakes, faster to market, less fragile, hence lower costs. What can we do that makes it easier for a tool supplier providing a simpler interface to produce OAS compliant documentation? A means that negates the need for manually updating and managing JSON schema? This would still be API first, just not at a level so error prone. As a refence point I recently ran a large development shop using SAFe coupled with model driven development. The business objects and services defined in the model. A complier produced .xsd and OAS 3.0 where there was little need or opportunity for anyone to touch the schema. One service definition in the model could begat numerous (100s even) of resource names (APIs deployed). Didn’t care about the number of APIs as wasn’t trying to manage individual schema or even crazier, snippets of schema. There was no need to make omnibus APIs to save on development work. Who needs multipath statements when I can just define another facet of the model for the unique need of each path? My point being left shifting the development work away from working at the schema level works. A simpler schema is not the answer. It’s how can average developers define business objects together with what actions are to be taken against them. Then let tooling produce the needed artifacts to deploy using a spec such as OAS 3.1. |
Beta Was this translation helpful? Give feedback.
-
I 100% agree with this. The salient API-first approaches still concentrate on the primacy of the OpenAPI document as the vehicle for specification development, which is what many developers rally against from a code-first perspective. Being able to drive this from a common modelling approach, which is still API-first but removes the dependency on the OpenAPI document would be a big boost. The modelling approach would help drive the API specification, which then drives the code. That extra layer of abstraction would be really helpful for lots of folks, and allow for commonality in tooling on how to drive it. |
Beta Was this translation helpful? Give feedback.
-
"Merge" with AsyncAPI in order to have one (and only one) specification language (and therefore, hopefully, ecosystem of tools) to define/document both synchronous (request-response) communication patterns and asynchronous (publish-subscribe) communication patterns for APIs. |
Beta Was this translation helpful? Give feedback.
-
Remove the |
Beta Was this translation helpful? Give feedback.
-
I18n |
Beta Was this translation helpful? Give feedback.
-
I'm not sure adding a We have many GET/DELETE operations requiring custom headers in the Request and it's not currently possible to reuse my components/headers in these operations because a headers map doesn't exist on the operation object and we don't allow request bodies on these operations. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I've raised this on slack, so I guess I should raise it here as well:
|
Beta Was this translation helpful? Give feedback.
-
Which reminds me, we can apply media types to the entire query string. The one that everyone thinks is "standard" (but is not actually part of RFC 3986 at all) is Furthermore, doing so allows use of the To address some of @karenetheridge 's concerns about This could either be a hybrid thing like using JSON Schema's |
Beta Was this translation helpful? Give feedback.
-
Consider flattening the responses object to an array that uses pattern matching to define the corresponding response object. /pet:
get:
responses:
- criteria:
status: '200'
mediaType: application/json
conditions:
"$/response/body#/petType": dog
"$/request.path.format": json
description: Success
schema:
type: object
properties:
name:
type: string
barkVolume:
type: number This would significantly reduce the nesting for simple API designs, provide support for more sophisticated interactions. It would allow mapping request values to specific responses, which is a common feature request. |
Beta Was this translation helpful? Give feedback.
-
Consider Operation Examples In 3.1, we can describe examples for media type objects, individual parameters, schemas, and schema properties. However, we can't describe a cohesive operation example (for example, this request parameter with that request body leads to these response headers and this response body). This makes the current mechanism of describing examples sometimes incongruent. |
Beta Was this translation helpful? Give feedback.
-
Allow duplicate paths(Note: I'm sure there are issues on this already, but I couldn't find them. Sorry.) SituationOAS <= 3.1 does not allow for duplicate paths. It makes some of these use cases more difficult:
Complications
Ideas
My personal preference is the last option to keep the paths more organized. I do think there is opportunity for further flattening. For example, move all props current in the path item object down into the operation object. Flatter, with more possible repetition, seems better than deeper as far as what seems like newer people understanding OAS. In other words, simplify by eliminating the path item object and making it an array of operations. |
Beta Was this translation helpful? Give feedback.
-
Move
|
Beta Was this translation helpful? Give feedback.
-
Represent
|
Beta Was this translation helpful? Give feedback.
-
Maybe an unpopular opinion but I would vote against any "big, radical changes". It looks like tooling authors can't keep up the pace of the changes. I see too many people still stuck on 2.0 because "tool X doesn't support 3.0". I believe this is a result of series of huge changes: 2.0 -> 3.0 and, 3.0 -> 3.1 (the latter one doesn't seem like a big change but the new JSON Schema version has much more complexity for tooling authors beyond data validation). I'm not against breaking changes. They are needed for sure. But I would focus on small quality-of-life-improvement changes that won't introduce too much complexity for tooling authors (like this or this). |
Beta Was this translation helpful? Give feedback.
-
Allow describing the
|
Beta Was this translation helpful? Give feedback.
-
How about limiting tag names to the same set of characters that component names are limited to ( Also have tags be a map where the key is the tagName. That structurally prevents tag collisions. |
Beta Was this translation helpful? Give feedback.
-
This may be more appropriate for the json schema side of things (Im never sure where the line is), but one of the biggest issues I have consistently encountered is lack of generics support. Specifically, for things like paginated endpoints where I have a common data structure to return. {
"Cursor": {
"Previous": 0,
"This": 10,
"Next": 20
},
"ItemCount": 10,
"Data": [
//one of N different objects.
]
} To properly define this within my sachems, I have to re-define the pagination object every time, with the data set to the whatever I am paging in that endpoints case. Another example that could use it would be structured error returning. I can return a general error with a message and code most of the time, but there are a few edge cases where I want to return some form of structured data in the error itself, and for each of those I have to redefine the wrapping error object. |
Beta Was this translation helpful? Give feedback.
-
You can also check out RFC7807 for a problem+json schema error response.
…On Wed, Feb 22, 2023, 01:17 deef ***@***.***> wrote:
This may be more appropriate for the json schema side of things (Im never
sure where the line is), but one of the biggest issues I have consistently
encountered is lack of generics support. Specifically, for things like
paginated endpoints where I have a common data structure to return.
{
"Cursor": {
"Previous": 0,
"This": 10,
"Next": 20
},
"ItemCount": 10,
"Data": [
//one of N different objects.
]
}
To properly define this within my sachems, I have to re-define the
pagination object every time, with the data set to the whatever I am paging
in that endpoints case.
Another example that could use it would be structured error returning. I
can return a general error with a message and code most of the time, but
there are a few edge cases where I want to return some form of structured
data in the error itself, and for each of those I have to redefine the
wrapping error object.
—
Reply to this email directly, view it on GitHub
<https://github.com/OAI/OpenAPI-Specification/discussions/2930#discussioncomment-5073313>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHU7MTMC3L2OPNJKRA5KRHTWYWVRLANCNFSM5WSVJSEQ>
.
You are receiving this because you commented.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Replace the
3.X.X security requirement
Becomes:
This would eliminate the unnecessary Security Requirement Object and have ref follow conventional patterns for Security Scheme |
Beta Was this translation helpful? Give feedback.
-
How about replacing server variable object with a schema object of type string? The Schema already contains enum, default, and description as fields. |
Beta Was this translation helpful? Give feedback.
-
I would like a (better) way to document a request and response body for a human readable metadata payload along with binary content. Our use case is similar to ftp file upload or EDI centric behavior such as a server to server request where binary content is uploaded and a metadata JSON payload is also included alongside to describe the file. From my understanding, the request body can only be one type of mediatype per request. In this example, We need to document both parts of the request, but there's no way to tie them together in the same way the {
"requestBodies": {
"sampleMixedRequestBody": {
"description": "A description of the request",
"content": {
"application/octet-stream": {
"schema": {
"type": "string",
"format": "binary"
}
},
"application/json": {
"schema": {
"type": "object",
"properties": {
"fileName": {
"type": "string"
},
"fileSize":{
"type": "number"
},
"fileSaveLocation": {
"type": "uri-reference"
}
}
}
}
},
"required": true
}
}
} |
Beta Was this translation helpful? Give feedback.
-
Improvements for links in v4I've put together a proposal for reworking/extending support for links in OASv4/Moonwalk. https://gist.github.com/mikekistler/1983a8249c0df56a46f94b4df1b7181d I'd be happy for feedback on this. |
Beta Was this translation helpful? Give feedback.
-
I have added a proposal for an archetype field for paths. The archetype field would allow for the assignment or declaration of a design or architectural pattern to paths. This would be extremely useful for documentation, tools, and testing. Motivation When working with larger product API sets that span multiple features and teams, it is important to ensure that the "Paths" associated with the different features produce consistent patterns of behavior across the entire product API. It is also equally important that API Paths communicate any patterns they are attempting to implement to the tools that will work with the API reflection document. When API path sets are tested, the tests need to ensure that the path, properly implements all aspects of specific archetypical patterns. For example, an api path that implements a 'editable-collection' pattern for users on '/v1/users/' might need to adhere to the following set of design rules:
Having the information about the archetype that an API is supposed to implement is critical for testing to ensure that the APIs are meeting architectural standards across the entire API. Also, when API path information is consumed by a code generation tool that is attempting to create an interop client, the tool can utilize the archetype information declared for a path to help tune the generated code to better align with the intended behavioral patterns and functionality. By providing archetype desciptions for paths, the OpenAPI document can play a vital role in ensuring that APIs are testable across larger API sets and that code generators have the informaiton they need to properly implement API interop patterns for APIs. Proposed solution The proposed solution is to add an 'archetype' field that is declared for a path. The archetype field provides a unique identifier that describes any special architectural design rules that a path should follow in its implementation and that provides detailed design information for code generation tool creators. Examples ` "/v1/users/{user-id}": { |
Beta Was this translation helpful? Give feedback.
-
If you just want to link to an external markdown file, you can use
`externalDocs` at the operation level and put any link you want.
…On Sat, Sep 23, 2023, 20:34 Myron Walker ***@***.***> wrote:
Remember, the type is offered by the 3rd party. The types are not part of
the standard. What is part of the standard is a field for providing a type
hint. That is all, the standard will not dictate what types to use and
such. The implementer would use the field to define their own types.
{
"paths": {
"v1/users": {
"archetype": "http://someorg.com/api/types/pageable-collection.md"
},
"v1/users/{id/": {
"archetype": "http://someorg.com/api/types/collection-item.md"
}
}
Its literally just a field so you can put in a type hint. Just like the
methods have a 'operationId' hint that code generators can use.
—
Reply to this email directly, view it on GitHub
<https://github.com/OAI/OpenAPI-Specification/discussions/2930#discussioncomment-7091373>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHU7MTJGPL3YT47JNNERA4DX3552PANCNFSM5WSVJSEQ>
.
You are receiving this because you commented.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Add support for core TypeScript features, like: |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
How about requiring the same naming convention that protobuf uses for components and property names? https://protobuf.dev/programming-guides/style/ |
Beta Was this translation helpful? Give feedback.
-
@earth2marsh @darrelmiller @lornajane should we transfer this discussion to the Moonwalk repo to keep things in one place? (I don't have the permissions on the moonwalk repo to do that, so please transfer if you think it should be done). |
Beta Was this translation helpful? Give feedback.
-
I wish these were all separate discussions. It's hard to track them all here. |
Beta Was this translation helpful? Give feedback.
-
We would like to take an opportunity to discuss what might be some big, radical changes that could be done in a 4.0 version that would address issues with OAS that we have not been able to address with past changes.
Let us know what major changes you think would make a significant improvement to the way you describe your APIs.
Updated request: Since we converted the issue to a discussion, it allows us for better threaded and voting capabilities for different ideas. If you have several suggestions, consider separating to separate replies so those could be considered individually.
Beta Was this translation helpful? Give feedback.
All reactions