OpenAPI Definition Document Validation Failures
We make use of the OpenAPI (aka Swagger) Definitions to generate client side code.
We've noticed recently that using later versions of the OpenAPI Code Generators, around half of the definitions fail validation.
We've narrowed down the cause to the same issues within each definition: Missing array items type/ref schemas.
Correctly formed array definitions for responses, paramaters and properties look like this:
"type": "array",
"items": {
"type": "string"
}
or
"type": "array",
"items": {
"$ref": "#/definitions/CustomField"
}
However, the API Definitions listed below are missing the items elements, usually globally within the document.
The relevant documents failing validation are:
Church Volunteer, Communication Preference, Constituent, Event, Fundraising, Gift, NXT Data Integration, Opportunity and Statistical Unit.
Or, looking at it the other way around, the following definitions pass validation:
Accounts Payable, General Ledger, Gift Batch, Gift v2, List, One Roster, Payments, School, Treasury and Webhook.
The validator error looks like this (for the Event API definition):
Validation failed. /paths/v1/events/{event_id}/participants/get/parameters/participation_level is an array, so it must include an "items" schema
(Only the first-found error is detailed.)
The fix is quite simple; just add in the items type/ref definitions, even if they're just string. (We currently manually modify the definition documents to add the items definitions.)
Anyway, I'm asking whether these definitions might be corrected at some point. I'm happy to provide further information if necessary.
Thanks.
Steve Cinquegrana | CEO and Principal Developer | Protégé Solutions
Comments
-
Interesting. I've seen validation errors with some of these definitions as well but didn't know what the issue was. Good to know I can fix it for my own use if I need to.
0 -
@Ben Regier This does the trick:
' Fix missing array items schemas
sFileContents = sFileContents.Replace("""type"": ""array""
}", """type"": ""array"",
""items"": {
""type"": ""string""}
}")Looks a bit messy but this maintains the document formatting, indenting, etc. (Community posts no longer support a code format type unfortunately.)
1 -
@Steven Cinquegrana This is a known issue. We are reaching out to the vendor again to check the status of the issue.
0 -
@Daniel Leonard Ok, thanks. Could you post here if/when there's any update? From our POV we'd prefer that there're not any breakages to the rest of the definitions if possible. Cheers.
0 -
@Steven Cinquegrana We will update this post when we hear something
0 -
@Daniel Leonard Hi. I've noticed that many of the specs have been updated, and mostly fixed. Obviously, that's a good thing. Thanks.
One new issue that has arisen with later code generator versions is that nullable type are not being supported by default (since about mid-2019) and the SKY specs are not currently specifying nullables with x-nullable (being OpenAPI v2.0 specs).
An example is the VendorPaymentDefault credit_limit property:
"VendorPaymentDefault": {
"description": "Vendor Information.",
"required": [
"payment_method",
"payment_option"
],
"type": "object",
"properties": {
…
"credit_limit": {
"format": "double",
"description": "The credit limit, if any.",
"type": "number",
"x-ms-summary": "Credit limit"
},Generated C# code looks like this:
public VendorPaymentDefault( … double creditLimit = default(double), …
Note that this property is specified as type number and format double. But the API can return null values which break the generated code.
Adding a x-nullable = true directive results in correctly generated code:
"credit_limit": {
"format": "double",
"description": "The credit limit, if any.",
"type": "number",
"x-nullable": true,
"x-ms-summary": "Credit limit"public VendorPaymentDefault( … double? creditLimit = default(double?), …
Is there any chance that these directives can be added to the specifications where appropriate, that is, wherever a returning value can be null and the type is not intrinsically nullable? Currently, we're pre-processing the definitions to add these directives which seems a bit extreme.
Cheers,
Steve Cinquegrana | CEO and Principal Developer | Protégé Solutions
PS The General Ledger definition has an error at line 6057 where the description doesn't include a string or the required schema:
"400": {
"description": "",It should look something like this:
"400": {
"description": "Returned when the request is not in the correct format.",
"schema": {
"$ref": "#/definitions/DomainErrorMessage"
}0 -
@Steven Cinquegrana I have forwarded the information to the team that owns those API's. We will reply here when we have more information.
0
Categories
- All Categories
- 6 Blackbaud Community Help
- 211 bbcon®
- 1.4K Blackbaud Altru®
- 402 Blackbaud Award Management™ and Blackbaud Stewardship Management™
- 1.1K Blackbaud CRM™ and Blackbaud Internet Solutions™
- 15 donorCentrics®
- 360 Blackbaud eTapestry®
- 2.6K Blackbaud Financial Edge NXT®
- 655 Blackbaud Grantmaking™
- 576 Blackbaud Education Management Solutions for Higher Education
- 3.2K Blackbaud Education Management Solutions for K-12 Schools
- 940 Blackbaud Luminate Online® and Blackbaud TeamRaiser®
- 84 JustGiving® from Blackbaud®
- 6.7K Blackbaud Raiser's Edge NXT®
- 3.7K SKY Developer
- 248 ResearchPoint™
- 120 Blackbaud Tuition Management™
- 165 Organizational Best Practices
- 240 Member Lounge (Just for Fun)
- 34 Blackbaud Community Challenges
- 37 PowerUp Challenges
- 3 (Open) PowerUp Challenge: Grid View Batch
- 3 (Closed) PowerUp Challenge: Chat for Blackbaud AI
- 3 (Closed) PowerUp Challenge: Data Health
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Product Update Briefing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports+
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Email Marketing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Gift Management
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Event Management
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Home Page
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Query
- 796 Community News
- 3K Jobs Board
- 54 Blackbaud SKY® Reporting Announcements
- 47 Blackbaud CRM Higher Ed Product Advisory Group (HE PAG)
- 19 Blackbaud CRM Product Advisory Group (BBCRM PAG)

