BigCommerce API Spec errors - bigcommerce

I am try to use the BigCommerce API Spec (below) in Postman but I keep getting the error "Error while importing: format not recognized" Screenshot - Postman API Spec Import error
https://github.com/bigcommerce/api-specs/blob/master/reference/catalog.v3.yml
When I download the spec and import the file into Swagger editor online -https://editor.swagger.io/ - I get the below validation errors; am I doing something wrong here or how can I get this to load into Postman?
Screenshot - Swagger Editor
Structural error at info.contact.url
should match format "uri"
format: uri
Jump to line 85
Structural error at paths./catalog/products/{product_id}/options/{option_id}.put.responses.200.schema.properties.data.allOf.0.properties.option_values.items.allOf.0.properties.value_data.type
should be equal to one of the allowed values
allowedValues: array, boolean, integer, number, object, string
Jump to line 4867
Structural error at paths./catalog/products/{product_id}/options/{option_id}/values.get.responses.200.schema.properties.data.items.allOf.0.properties.value_data.type
should be equal to one of the allowed values
allowedValues: array, boolean, integer, number, object, string
Jump to line 5099
Structural error at paths./catalog/products/{product_id}/options/{option_id}/values.post.responses.200.schema.properties.data.allOf.0.properties.value_data.type
should be equal to one of the allowed values
allowedValues: array, boolean, integer, number, object, string
Jump to line 5263
Structural error at paths./catalog/products/{product_id}/options/{option_id}/values/{value_id}.get.responses.200.schema.properties.data.allOf.0.properties.value_data.type
should be equal to one of the allowed values
allowedValues: array, boolean, integer, number, object, string
Jump to line 5394
Structural error at paths./catalog/products/{product_id}/options/{option_id}/values/{value_id}.put.responses.200.schema.properties.data.allOf.0.properties.value_data.type
should be equal to one of the allowed values
allowedValues: array, boolean, integer, number, object, string
Jump to line 5547
Semantic error at paths./catalog/products/{product_id}/modifiers/{modifier_id}/values/{value_id}.get.security.0
Security requirements must match a security definition
Jump to line 7941
Structural error at definitions.productModifierOptionValue_Base.properties.value_data.type
should be equal to one of the allowed values
allowedValues: array, boolean, integer, number, object, string
Jump to line 18131
Semantic error at definitions.productModifierOptionValue_Base.properties.value_data.type
Schema "type" key must be a string
Jump to line 18131
Structural error at definitions.productOptionOptionValue_Base.properties.value_data.type
should be equal to one of the allowed values
allowedValues: array, boolean, integer, number, object, string
Jump to line 19731
Semantic error at definitions.productOptionOptionValue_Base.properties.value_data.type
Schema "type" key must be a string
Jump to line 19731
Semantic error at security.0
Security requirements must match a security definition
Jump to line 21888
Please help.
Thanks,
Rory

If the api-specs github repo, https://github.com/bigcommerce/api-specs, is not working when using with postman, you can use the Request Runners on the API Reference docs to do test calls.
This is a known issue. There are internal plans to resolve this, however, until then I'd recommend running tests in the request runner.

Related

cypher cast string to integer in Agensgraph

I use the following query, this returns string values:
MATCH (n:artefact) RETURN (n.id)
I'm trying to cast the string to an integer, so I use the following:
MATCH (n:artefact) RETURN toInteger(n.id)
This returns the error:
[FAIL] BadSqlGrammarException->StatementCallback; bad SQL grammar [MATCH (n:artefact) RETURN toInteger(n.id);]; nested exception is org.postgresql.util.PSQLException: ERROR: function tointeger(jsonb) does not exist
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
I've also tried toInt()
I'm guessing the function tointeger(jsonb) does not exist is the issue, is it trying to convert the entire jsonb in an integer rather than just the n.id?
How do I resolve this?
I'm using Agensgraph, when I start agens browser it states check version of AgensGraph ... v1.2 or under

Format - Expected Array

I keep getting an error when I try to format this number. I've done it in VBA before and I tried to change the SOPID to a variant, a string, and an integer.
Dim SOPID As Integer
SOPID = DMax("file_id", "tblSOP") + 1
'Output test data
MsgBox (format(SOPID, "000"))
I have no idea what I am doing wrong.
Assuming the code was pasted directly from your IDE, the casing of format is suspicious; that would be Format, unless there's a format variable or function that's in-scope, ...and that's being invoked here.
Look for a public (could be implicitly Public, or if it's in the same module then it could also be Private) format function procedure that expects an array argument: that's very likely what's being invoked here.
Rubberduck (free, open-source; I manage this project) can help you easily identify exactly what's being invoked and an inspection would tell you about any shadowed declarations, but to be sure you can fully-qualify the function call to avoid inadvertently invoking another function that's in scope:
MsgBox VBA.Strings.Format$(SOPID, "000")
Note that there are no parentheses around the argument list of a parameterized procedure call in VBA; the parentheses you have there are surrounding the first argument and making the expression be evaluated as a value that is then passed to the invoked function: this isn't necessary.
Also note the $: the VBA.Strings.Format function takes and returns a Variant; VBA.Strings.Format$ takes and returns a String. If you aren't dealing with any Null values (an Integer couldn't be Null), consider using the String-returning alias.

Why is this structure declaration allowed in a built-in Function Module but not in a new one?

I'm working on a Function Module to assist with dealing with included text with logic embedded. While looking into the way SAP handles SAPScript files and parses the logic I found a structure that is declared as so:
DATA BEGIN OF events OCCURS 100.
INCLUDE STRUCTURE ITCCA.
DATA: command LIKE BOOLEAN,
template LIKE BOOLEAN,
mask LIKE BOOLEAN,
END OF events.
This obviously works, as I can trace through it while it is running a print program. So I thought I would try a similar structure in my own code but even when I copied the code 1 for 1 like above I get an error during activation. The error is
"BOOLEAN" must be a flat structure. Internal tables, references,
strings and structures are forbidden as components.
Can someone explain to me why this structure is valid in one program and not mine?
To explain the actual effect: LIKE usually refers to a data object (an actual variable) on the right-hand side, not a data type. As you rightly discovered, once you provide a data object named BOOLEAN, that is used to construct the type. If a data object of that name is not present and you're not within a class or an interface, an obsolete variant of the LIKE statement will be triggered that also takes data types into account, but only allows for certain elements on the right-hand side - namely only flat structured objects or their components. LIKE DATATYPE-BOOLEAN should have worked. As usual, the error message is somewhat less than helpful.
It seems during my initial investigation I missed a declaration for the BOOLEAN type. In the STXC function group SAP decided to declare their own variable for boolean in a different include file like this:
data: boolean(1) type c.
I had originally assumed that they were doing this with the dictionary defined type which has a similar name and is a 1 character long string. What I also found is that if I were to change my structure declaration like this:
DATA BEGIN OF events OCCURS 100.
INCLUDE STRUCTURE ITCCA.
DATA: command TYPE BOOLEAN,
template TYPE BOOLEAN,
mask TYPE BOOLEAN,
END OF events.
My code would be valid because it would then be using the dictionary defined value. So either I have to add a declaration for my own definition of boolean so that I can use the LIKE keyword or I have to use the TYPE keyword to use the dictionary definition.

Question mark in callback

static setItem(key: string, value: string, callback?: ?(error: ?Error) => void)
This is the declaration of setitem in AsyncStorage. the third parameter is a callback. Could some one explain the use of question marks here. I am familiar with how to use promise but couldn't get a handle of question mark.
AsyncStorage uses flow - Facebook's open-sourced static type checker. You will find #flow at the beginning of the file and it marks flow-enabled source. Flow does a lot of checking on the variable types (including automated type inference) but it also lets you specify the types for variables and parameters. In the example above 'key: string' for example indicates that key should be string type (it's not a valid javascript construct - you cannot specify type in javascript). React has built in transformers that transform it to pure javascript (so all the types are stripped) but before that flow checks if types are passed around properly and find things like passing null or undefined and using it later as object and many other checks. You can read the specs in http://flowtype.org/.
So answering your detailed questionmark question:
'?Error' indicates that error parameter is a "Maybe" type - i.e. it CAN be null and flow will not complain if null or undefined is passed here elsewhere in the code callback (http://flowtype.org/docs/nullable-types.html#type-annotating-null)
'callback?' indicates an optional parameter - so it might be skipped http://flowtype.org/docs/functions.html#function-based-type-annotations
'?(error...)' is another "Maybe" type - it simply indicates that the callback function might take one parameter ('error') or no parameters at all.

What is the vbError returned by VarType in VB6?

I have been searching for this all over the web, but everything is either talking about the ErrObject class, or the constant vbError returned by the VarType function. I want to know what that type actually is, e.g. an integer is something like 4, a string is something like "hello world", etc.
For a little background, here is a link to the official MSDN page about VarType, which shows all the constants it returns and what they represent. What is Error value?
If you are familiar with COM in C/C++, you should know that from that perspective VarType() is a simple function that essentially extracts the value of the vt member from the Variant passed in as a parameter. The possible values of the vt member are documented in many places, such as here.
If you check inside of the COM system headers (e.g. WTypes.h distributed as part of in the Windows SDK), you will see that the VbError value of 10 indeed maps to the C/C++ enum value of VT_ERROR.
enum VARENUM
{ VT_EMPTY = 0,
...
VT_ERROR = 10,
...
} ;
The MSDN link above describes the meaning of a vt that equals VT_ERROR as follows:
An SCODE was specified. The type of the error is specified in scode.
Generally, operations on error values should raise an exception or propagate the error to the return value, as appropriate.
So, here's basically what it means:
A Variant obviously supports storing many types of values, and among them is the obscure possibility of storing an "Error Code". More correctly, these codes are formally called scode's, because they can indicate many types of "success" as well as "failures". Most people refer to these codes as HRESULTs.
These codes are the same kind of "Error Codes" that you get from Err.Number in VB6. So, you can tell a Variant to distinguish an "Error Code" from just a plain number.
In reality, few programs or COM components - if any - will ever put error codes in Variants. Almost everybody just issues COM Exceptions to communicate errors (this mechanism is exposed in VB6 via the Err object). Even those components that return error codes outside of the COM Exception mechanism, would likely do so in typed variables (e.g. Long's).
Therefore, the reason this possible return value exists is for completeness. You will almost never see it in real life.
(Edit: Remove bit about not being able to create an "Error" variant. #Joe proved me wrong on that. You can use CVErr() to create one)
In VB6 and VBA, error values are created by calling the CVErr function.
This function returns a Variant whose VarType is vbError, and for which the IsError function returns True.
A typical use case for this is an Excel UDF that returns a Variant: if you return an error value, it will display as #VALUE!.