-
-
Notifications
You must be signed in to change notification settings - Fork 48
Milestone
Description
One of the things that will help to consume/expose Http-based datasets would be to be able to infer/generate OpenAPI specification for a given dataset.
Here is an example scenario, let's say we want to expose a dataset through the API (instead of granting read-only access to our filesystem/db).
Let say this is our schema:
$schema = schema(
int_schema('id', $nullable = false),
str_schema('name', $nullable = true),
bool_schema('active', $nullable = false, Metadata::empty()->add('key', 'value')),
);Lets build a OpenAPI specification for that endpoint:
openapi: 3.0.0
info:
title: User API
version: 1.0.0
paths:
/users:
get:
summary: Get list of users
responses:
'200':
description: A list of users
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
nullable: false
example: 1
name:
type: string
nullable: true
example: "John Doe"
active:
type: boolean
nullable: false
example: true
components:
schemas:
User:
type: object
properties:
id:
type: integer
nullable: false
name:
type: string
nullable: true
active:
type: boolean
nullable: falseIf we take a closer look properties are 1:1 translatable to/from Flow Schema.
We can add it as a new Bridge src/bridge/openapi/flow/ that would provide two converters:
- Flow to OpenAPI
- OpenAPI to Flow
Sub-issues
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done