Closed adobekan closed 10 months ago
Here is an OpenAPI example as well
openapi: 3.1.0
info:
title: Vehicle Acceleration API
version: 1.0.1
servers:
- url: https://api.accelerationservice.com/v1
paths:
/vehicle/acceleration:
post:
summary: Provide Vehicle Acceleration Data
description: Endpoint to send vehicle acceleration data.
requestBody:
required: true
content:
application/json:
schema:
$ref: schema/mydemo_vehicle.schema.json#/Vehicle/$children/Acceleration
responses:
'200':
description: Success. Acceleration data received.
'400':
description: Bad Request. Invalid payload or data format.
/vehicle/acceleration/mySpecificLocationEvent:
get:
summary: Get Current Vehicle Data
description: Get the current location and acceleration data of the vehicle.
responses:
'200':
description: Success. Current vehicle data received.
content:
application/json:
schema:
type: object
properties:
Location:
$ref: schema/mydemo_vehicle.schema.yaml#/Vehicle/$children/CurrentLocation
Acceleration:
$ref: schema/mydemo_vehicle.schema.yaml#/Vehicle/$children/Acceleration
/vehicle/acceleration/TriggerService:
get:
summary: Get Current Vehicle Data
description: Get the current location and acceleration data of the vehicle.
parameters:
- name: longitudinal_threshold
in: query
description: Threshold for longitudinal acceleration (X-axis) in m/s^2.
schema:
type: number
- name: lateral_threshold
in: query
description: Threshold for lateral acceleration (Y-axis) in m/s^2.
schema:
type: number
responses:
'200':
description: Success. Current vehicle data received.
content:
application/json:
schema:
type: object
properties:
Timestamp:
type: string
format: date-time
description: The timestamp of the vehicle data.
Location:
$ref: schema/mydemo_vehicle.schema.yaml#/Vehicle/$children/CurrentLocation
Acceleration:
$ref: schema/mydemo_vehicle.schema.yaml#/Vehicle/$children/Acceleration
Meeting notes:
Commit sha: 0dc6a7f, Author: Adnan Bekan, Committer: Adnan Bekan; The sign-off is missing.
Two things I would like to have before merging it:
Another topic - do we want it to be included as a future release artifact? If so we should better update https://github.com/COVESA/vehicle_signal_specification/wiki/Release-Instructions-and-Checklist#create-output-artifacts and possibly the VSS Makefile as well to include it in builds/releases, but that can be done after this PR is merged
I agree on the tests and setup.py, currently however I do think this tool does not work correctly yet. It seems to create something that is almost but not entirely unlike a json schema
Investigating
The code dod not work with models that do not have Vehicle
in the root (such as test cases and probably EV charging group. Fixed it)
Added basic tests
The code dod not work with models that do not have
Vehicle
in the root (such as test cases and probably EV charging group. Fixed it)
Here i was
The code dod not work with models that do not have
Vehicle
in the root (such as test cases and probably EV charging group. Fixed it)
Was thinking about this one even in the case if you are defining API for only specific domain. Great.
Meeting notes:
Added documentation.
--extended-attributes , -e
seems to be broken, seems to only works with --jsonschema-all-extended-attributes
Will investigate
Added documentation.
--extended-attributes , -e
seems to be broken, seems to only works with--jsonschema-all-extended-attributes
Will investigate
Did not try that option. Could it be space where it was defined, maybe we have some overlapping with other tools?
Well. It works..... I think I mixed up some files when checking before. Marking this ready to review (or merge imo)
Meeting notes:
Work still in progress.
to try,
./vspec2jsonschema.py ../spec/VehicleSignalSpecification.vspec ../../mydemo.schema.json