Hello All,
Speaking from past experience with XML schema based APIs.
One matter to consider is what using schema-based validation actually gives you.
When working with a new or changed application which is providing an API, doing some conformance testing is useful. Validation against the OAS spec is useful in that case.
Similarly, when someone is working on a consuming application then checking against an OAS spec can help during development.
Reva: Validate requests with OpenAPI in Node.jsBut once integrated I am not certain that such a validation is likely to find much variation in API usage?
As Jonanthan said there are various projects for languages that provide validation packages like this one for Node.
APIs With Node.js and Express: Automatically Validate API Requests Using an OpenAPI 3 Specification - DZone IntegrationI have not used either of these, but I think the critical thing is that if you intend to validate this way in production you need two things.
First off will it be performant for a synchronous API?
Secondly, who is the recipient of any error messages? Are failed requests going to an error hospital for enterprise app support to deal with an issue or is this going back to the user of the client app. If it is the latter, you need a toolkit where errors can be caught and returned as more accessible error responses to go in entity representations associated with the appropriate http status code.
------------------------------
Derrick Evans
------------------------------
Original Message:
Sent: Oct 20, 2022 04:44
From: Jonathan Goldberg
Subject: SchemaLocation Query
Hi Rashmi
Unfortunately I don't know how to answer this question. I can only suggest that you search the internet for open-source or commercial validation frameworks.
Be aware that schema checking will add latency to your API response times.
------------------------------
Jonathan Goldberg
Amdocs Management Limited
Any opinions and statements made by me on this forum are purely personal, and do not necessarily reflect the position of the TM Forum or my employer.
Original Message:
Sent: Oct 06, 2022 22:00
From: Reshmi G C
Subject: SchemaLocation Query
Hi Jonathan,
We have a requirement that whenever we receive service order from external system,we have to validate the service order request to check if the request payload aligns to TMF 641 specification,if it does not then we reject the request.
Hence we were looking at schema for TMF 641 against which we can validate using any json schema validators rather than hand writing the rules to validate against incoming payload against the schema.
As per your message above,only updated reference for us is to go with swagger specifications which has the JSON schemas built in to it.So what is the suggested approach /best practise to do the request schema validation across various implementations you have seen so far?
Any inputs from your side would be very helpful
Regards,
Rashmi
------------------------------
Reshmi G C
Cisco Systems
Original Message:
Sent: Oct 06, 2022 02:37
From: Jonathan Goldberg
Subject: SchemaLocation Query
Hi Sean. Shivam, and all
Please be aware that the referred GitHub repository is not necessarily being maintained up-to-date. You will note that it was lasted refreshed 9 months ago.
If you need up-to-date schemas, you'll need to take them from the published Swagger/OAS files at the Open API table https://projects.tmforum.org/wiki/display/API/Open+API+Table
And be aware that these files contain the schemas after pre-processing. flattening, resolving allof, etc.
------------------------------
Jonathan Goldberg
Amdocs Management Limited
Any opinions and statements made by me on this forum are purely personal, and do not necessarily reflect the position of the TM Forum or my employer.
Original Message:
Sent: Oct 05, 2022 14:58
From: Sean Garagan
Subject: SchemaLocation Query
Hey Shivam,
The whole set of published APIs and schemas for v4 can be found at https://github.com/tmforum-apis/Open_Api_And_Data_Model. So under the schemas folder in that project are the JSON schemas but the 641 Swagger files are generated from these. This means that the API Swagger files have the JSON entities defined within them and as such are self-contained.
Thanks,
Sean
------------------------------
Sean Garagan
Bell Canada
Original Message:
Sent: Oct 05, 2022 13:07
From: Shivam Chauhan
Subject: SchemaLocation Query
Hi Sean,
Thanks for sharing the location for swagger, is there a JSON schema already available based on resource model of TMF 641 specification.
------------------------------
Shivam Chauhan
Zensar
Original Message:
Sent: Oct 05, 2022 09:52
From: Sean Garagan
Subject: SchemaLocation Query
Good day,
The schema for that API can be found at https://github.com/tmforum-apis/Open_Api_And_Data_Model/tree/master/apis/TMF641_Service_Ordering. This is part of the TMForum GitHub project that maintains all of the published APIs and schemas.
As for the content of @schemaLocation, that can reference a local repository of the schema. That way, if the app validates the message against the schema, it only needs to reference something within your network and not on the internet.
Sean
------------------------------
Sean Garagan
Bell Canada
Original Message:
Sent: Oct 04, 2022 13:57
From: Shivam Chauhan
Subject: SchemaLocation Query
Hi All,
1- Can you please provide URL where we can download schema of TMF641 V4.1.0?
"serviceCharacteristic": [
{
"name": "cloudone-service-create",
"valueType": "object",
"value": {
"@type": "JSONSpecification",
"@schemaLocation": "XXXXXXX"
}
}
]
2- What should mention in schema location in service characteristic should it be TMF 641 V4.1.0 schema location or custom to the service?
3- Does that schema location refer to the client's schema location or TMF implementation schema location?
#General
------------------------------
Shivam Chauhan
Zensar
------------------------------