cycleplatform / api-spec Goto Github PK
View Code? Open in Web Editor NEWOpenAPI spec files for Cycle APIs
License: Other
OpenAPI spec files for Cycle APIs
License: Other
GIven:
PipelineSteps:
title: PipelineStep
description: A step for a pipeline stage.
allOf:
- type: object
properties:
identifier:
type: string
description: An identifier for the step.
options:
type: object
properties:
skip:
type: boolean
- oneOf:
- $ref: '#/components/schemas/ImageSourceCreateStep'
- $ref: '#/components/schemas/ImageCreateStep'
- $ref: '#/components/schemas/ImageImportStep'
...
In the Rust generator I'm building, the components of allOf
are built/referenced and merged into a new type. This is straightforward with a couple of objects. However the oneOf
would naturally be represented as an enum like:
pub enum PipelineSteps {
ImageSourceCreateStep(ImageSourceCreateStep),
ImageCreateStep(ImageCreateStep),
ImageImportStep(ImageImportStep),
...
There is no obvious way (to me) to mix these together in a single type.
From looking at the online cycle docs, it appears that this PipelineStep(s) should contain only the oneOf
at the top level.
There are some properties written in kebab-case
, or camelCase
. They should likely concord with the more usual snake_case
.
For example:
cpu_cores:
type: number
description: The number of CPU Cores availiable for builds
In rust, at least, number
is interpreted as a float.
In any case, I believe number
should eschewed in favor of more explicit float or integer types.
I'm just getting started on testing out some live API's.
CreateEnvironment
and GetEnvironments
return a result of the type Environment
.
Environment
contains PrivateNetwork
which contains LegacyNetwork
.
In PrivateNetwork
this field (legacy
) is marked as required. For the generator, any field that is required must have a value, and can never be null, unless it is also marked as nullable
. This field is not so marked. Because it is a $ref
, the spec does not appear to allow a nullable
flag on the property.
I'm not certain what to do here.
I think you can place nullable
on the referenced definition, but that seems odd as it would then apply nullability to the property of the containing type.
If simply removing this field from the required list is possible, that would fix the generator.
Some models have not been switched over to reference explicit models, deriving inline, thus conflicting in the final generation.
These are:
StackBuildInstructions (StackBuild.instructions)
StackBuildAbout (StackBuild.about)
ImageSource (Image.source)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.