[AutodeskForge]I would like to know why the conversion fails ifc files contain single quotes at the end of certain attributes - autodesk-forge

I would like to know why the conversion fails if certain attributes contain trailing single quotes.
An ifc-file that contains single quotes (') at the end of certain attributes fails to translate.
The API I used
POST /modelderivative/v2/designdata/job
Target attribute value
EL-G35211AN/6-SP/L''
Data for the line containing the target attribute value in the ifc-file
#2340 = IFCFLOWTERMINAL('32hCanqHP0QAQmHARnRsKT', #2341, '\X2\30107167660E56685177FF0830E630FC30B630FC90E86750FF093011FF7CFF7DFF83FF9159294E95FF086D45578BFF09\X0\ EL-G35211AN/6-SP/L'', '\X2\6A5F566830FB56685177\X0\. \X2\30E630FC30B630FC90E86750\X0\', $, #2353, #2339, $);
#2346 = IFCLIGHTFIXTURETYPE('2A0TvRw8rCk8EKh4gObqVr', #2341, '\X2\30107167660E56685177FF0830E630FC30B630FC90E86750FF093011FF7CFF7DFF83FF9159294E95FF086D45578BFF09\X0\ EL-G35211AN/6-SP/L'', '\X2\6A5F566830FB56685177\X0\. \X2\30E630FC30B630FC90E86750\X0\', $, $, $, $, $, .NOTDEFINED.);#2390 = IFCPROPERTYSINGLEVALUE('\X2\540D79F0\X0\', '', IFCTEXT('\X2\FF7CFF7DFF83FF9159294E95FF086D45578BFF09\X0\ EL-G35211AN/6-SP/L''), $);
#2378 = IFCPROPERTYLISTVALUE('table_data', '', (IFCTEXT('SPVER,10,\X2\4ED569D866F830D030FC30B830E730F330B330FC30C9\X0\,'), IFCTEXT('CGRYCODE,403000000000000000,\X2\6A5F56685206985E30B330FC30C9\X0\,,'), IFCTEXT('NAME2,\X2\FF7CFF7DFF83FF9159294E95FF086D45578BFF09\X0\,\X2\578B5F0F540D79F0\X0\,'), IFCTEXT('NAME1,EL-G35211AN/6-SP/L'',\X2\30E130FC30AB30FC578B756A\X0\,')), $);
#2390 = IFCPROPERTYSINGLEVALUE('\X2\540D79F0\X0\', '', IFCTEXT('\X2\FF7CFF7DFF83FF9159294E95FF086D45578BFF09\X0\ EL-G35211AN/6-SP/L''), $);
#2398 = IFCPROPERTYSINGLEVALUE('\X2\578B756A\X0\', '', IFCTEXT('EL-G35211AN/6-SP/L''), $);
manifest
{
"urn": "XXXXXXXXXX",
"derivatives": [
{
"hasThumbnail": "false",
"name": "XXXXXXXX.ifc",
"progress": "complete",
"messages": [
{
"type": "error",
"code": "Navisworks-Internal",
"message": "Error code: 2 - bec9343c395241f266d3b7af86dee70e041d7687d3b4f0f0c0952b04ff3c39eb.ifc could not be opened because the contents are corrupt or it is currently unavailable.\n\nIt is recommended to re-open your model to avoid data loss.\n"
},
{
"type": "error",
"message": "Unrecoverable exit code from extractor: -1073741829",
"code": "TranslationWorker-InternalFailure"
}
],
"outputType": "svf2",
"status": "failed"
}
],
"hasThumbnail": "false",
"progress": "complete",
"type": "manifest",
"region": "US",
"version": "1.0",
"status": "failed"
}
I would like to know what is causing the inability to translate.

I'm not closely familiar with the IFC format but the following line from your question seems off:
#2340 = IFCFLOWTERMINAL('32...KT', #2341, '\X2\30...09\X0\ EL-G35211AN/6-SP/L'', '\X2\6A...50\X0\', $, #2353, #2339, $);
Since the format apparently uses single quotes to delimit string values, the two single quotes seem incorrect. Shouldn't the first quote be escaped?
Also, are you able to open this IFC file in any desktop IFC viewer? If you can, then I'd suggest that you send the IFC file to us via forge (dot) help (at) autodesk (dot) com (confidentially - we would not share the file with anyone outside of Autodesk), and we would ask our engineering to debug the conversion.

Related

Azure Functions Route binding with unknown URL

I'm trying to construct the function.json file where the url has a custom ending that we don't know. This customer ending may include forward slashes so I can't be guaranteed this will be one parameter. My current code :
{
"bindings": [
{
"authLevel": "function",
"type": "httpTrigger",
"direction": "in",
"route": "{param1}/customer/{param2}/{restOfUrl}",
"name": "req",
"methods": [
"get"
]
},
{
"type": "http",
"direction": "out",
"name": "res"
}
],
"scriptFile": "../dist/src/handlers/myScript.js"
}
this works fine when for example the url is:
...123/customer/456/rest-of-url
however if the rest of the url contains forward slashes eg:
...123/customer/456/rest/of/url
I get a 404 not found.
How do I correctly define the route if the url is unknown and will likely include forward slashes / ?
After trying the suggested solution I discovered this doc in Azure documentation. The solution was to * the remaining parameter which returns the remainder of the path as a string. The change looks as so :
"route": "{param1}/customer/{param2}/{*restOfUrl}"
There is an appsetting to disable the url encoding so that it will match a full path. By default slashes are encoded as %2F
https://learn.microsoft.com/en-us/azure/azure-functions/functions-app-settings#azure_function_proxy_backend_url_decode_slashes

Executing a specific http method 'depending' on the condition given in the JSON file

I was thinking about the possibility of executing a specific http method (POST or PUT) in POSTMAN without specifying it.
I mean; imagine if there was a field in a JSON file called: METHOD within 2 possible states: 'I' corresponding to INSERT OR POST and the another one: 'U' related to UPDATE or PUT
Something like this: (please, do note the field called "method"):
[
{
"sku": "95LB645R34ER",
"method": 'I'
"payload": {
"price": "147000",
"tax_percentage": "US-21",
"store_code": "B2BUSD",
"markup_top": "1.62",
"status": "1",
"group_prices": [
{
"group": "CLASS A",
"price": "700038.79",
"website": "B2BUSD"
}
]
}
},
{
"sku": "95TYS34344ER",
"method": 'U'
"payload": {
"price": "69978",
"tax_percentage": "US-21",
"store_code": "B2BUSD",
"markup_top": "9.99",
"status": "1",
"group_prices": [
{
"group": "CLASS B",
"price": "88888.79",
"website": "B2BUSD"
}
]
}
}
]
I would like to run that JSON using the Collection Runner but i have no idea how to do the trick. I mean, everytime i generate a collection i have to specify the HTTP METHOD otherwise it wont know what to do.
I want the program to adjust that by looking at the JSON file, if "method":'I' then, perform a POST or if "method":'U' execute a PUT method. Do you get me?
I've been reading the documentation but i did not find something like that or maybe i did not understand. I'm not an expert on POSTMAN :(
Can you help me?
EDIT:
Alright, i did this:
In the request UI, use the {{METHOD}} syntax where you would see the HTTP method. This is an editable field as it allows you to add custom HTTP methods.
In the file, use the METHOD key and any HTTP verb as the value. Ensure that it's part of each object in the datafile as you will need it for each iteration.

Parsing string containing complex struct

I'm receiving a third-party API payload response like:
{
"message": "Validation failed because [{reason=CONDITIONAL_INVALID_VALUE, field=/targetingCriteria, batchIndex=0, type=INVALID_VALUE, message=/locale cannot be set to en if urn:li:adTargetingFacet:interfaceLocales is set to urn:li:locale:it_IT, parameters={field1=/locale, value2=urn:li:locale:it_IT, value1=en, field2=urn:li:adTargetingFacet:interfaceLocales, key=}}, {reason=FIELD_VALUE_TOO_LOW, field=dailyBudget, batchIndex=0, type=INVALID_VALUE, message=/dailyBudget/amount value 1 cannot be lower than 10.00, parameters={min=10.00, field=/dailyBudget/amount, costType=CPM, type=SPONSORED_UPDATES, value=1, key=}}]",
"status": 400
}
and I'd like to transform in something like:
{
"errors": [{
"reason": "CONDITIONAL_INVALID_VALUE",
"field": "/targetingCriteria",
"batchIndex": "0",
"type": "INVALID_VALUE",
"message": "/locale cannot be set to en if urn:li:adTargetingFacet:interfaceLocales is set to urn:li:locale:it_IT",
"parameters": "{field1=/locale, value2=urn:li:locale:it_IT, value1=en, field2=urn:li:adTargetingFacet:interfaceLocales, key=}"
},
{
"reason": "FIELD_VALUE_TOO_LOW",
"field": "dailyBudget",
"batchIndex": "0",
"type": "INVALID_VALUE",
"message": "/dailyBudget/amount value 1 cannot be lower than 10.00",
"parameters": "{min=10.00, field=/dailyBudget/amount, costType=CPM, type=SPONSORED_UPDATES, value=1, key=}"
}
]
}
But I'm struggling to find a clear golang approach to this problem, the main problems are:
no valid json is available: word are not correctly quoted with "
= symbol instead of :
nested graphs bracket
I'm currently try to transform in a valid json string and then parse as json but I have various problem with nested elements
Any idea?
EDIT: This is what I've done right now: https://play.golang.org/p/B7bdPCJoHc2

GitHub API JSON contains new lines (\n)

I'm using the GitHub API to access the content of a certain file and I'm getting \n within the value of the JSON keys content. Why are those \n there?
The content is b64 encoded but obviously with those \n the decoding fails. I could write some code to remove the \n but what is the reason they are there?
Example: https://api.github.com/repos/grantae/mips32r1_xum/contents/README
{
"name": "README",
"path": "README",
"sha": "2d77ad7f50cc6843ea06b0b48d6935c57b7b5577",
"size": 3997,
"url": "https://api.github.com/repos/grantae/mips32r1_xum/contents/README?ref=master",
"html_url": "https://github.com/grantae/mips32r1_xum/blob/master/README",
"git_url": "https://api.github.com/repos/grantae/mips32r1_xum/git/blobs/2d77ad7f50cc6843ea06b0b48d6935c57b7b5577",
"download_url": "https://raw.githubusercontent.com/grantae/mips32r1_xum/master/README",
"type": "file",
"content": "TUlQUzMyUjEgLSAxIEphbiAyMDE0DQotLS0tLS0tLS0tLS0tLS0tLS0tLS0N\nCg0KVGhpcyBpcyBhbiBpbXBsZW1lbnRhdGlvbiBvZiB0aGUgTUlQUzMyIFJl\nbGVhc2UgMSBwcm9jZXNzb3IuDQoNClRoaXMgZGVzaWduIHdhcyBjcmVhdGVk\nIGJ5IEdyYW50IEF5ZXJzIGFuZCBmdW5kZWQgYnkgdGhlIA0KZVh0ZW5zaWJs\nZSBVdGFoIE11bHRpY29yZSAoWFVNKSBwcm9qZWN0IGF0IHRoZSBVbml2ZXJz\naXR5IG9mIFV0YWgNCmZyb20gMjAxMC0yMDEyLiBJdCB3YXMgcHJldmlvdXNs\neSBob3N0ZWQgb24gT3BlbkNvcmVzIGFzICdtaXBzMzJyMScuDQpGZWVsIGZy\nZWUgdG8gc2VuZCBxdWVzdGlvbnMgb3IgZmVlZGJhY2sgdG8gYXllcnMgQVQg\nY3Muc3RhbmZvcmQuZWR1Lg0KDQoNClByb2Nlc3NvciBEZXRhaWxzDQotLS0t\nLS0tLS0tLS0tLS0tLQ0KDQotIFNpbmdsZS1pc3N1ZSBpbi1vcmRlciA1LXN0\nYWdlIHBpcGVsaW5lIHdpdGggZnVsbCBmb3J3YXJkaW5nIGFuZCBoYXphcmQg\nZGV0ZWN0aW9uLg0KLSBIYXJ2YXJkIGFyY2hpdGVjdHVyZSB3aXRoIHNlcGFy\nYXRlIGluc3RydWN0aW9uIGFuZCBkYXRhIHBvcnRzIHdoaWNoIGNhbiBiZSAN\nCiAgY29tYmluZWQgaWYgZGVzaXJlZC4NCi0gQWxsIHJlcXVpcmVkIE1JUFMz\nMiBpbnN0cnVjdGlvbnMgYXJlIGltcGxlbWVudGVkLCBpbmN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gaW1wbGVtZW50YXRp\nb24gb2YgdGhlIFhVTSBib290bG9hZGVyLg0KDQoNCkxlZ2FsDQotLS0tLQ0K\nDQpBbGwgc29mdHdhcmUgYW5kIGhhcmR3YXJlIGluY2x1ZGVkIGluIHRoaXMg\nZGlzdHJpYnV0aW9uIGlzIGxpY2Vuc2VkIHVuZGVyDQp0aGUgR05VIExHUEwu\nIFNlZSB0aGUgZmlsZSAnTEVHQUwnIGluIHRoaXMgc2FtZSBkaXJlY3Rvcnkg\nZm9yIG1vcmUgaW5mb3JtYXRpb24uDQoNCg0KRW5qb3khDQoNCg==\n",
"encoding": "base64",
"_links": {
"self": "https://api.github.com/repos/grantae/mips32r1_xum/contents/README?ref=master",
"git": "https://api.github.com/repos/grantae/mips32r1_xum/git/blobs/2d77ad7f50cc6843ea06b0b48d6935c57b7b5577",
"html": "https://github.com/grantae/mips32r1_xum/blob/master/README"
}
}
You may try to use a different base64 decoding library to deal with those \n
var base64 = require('js-base64').Base64;
var contents = base64.decode(res.content);
It would work the same as GitHub API call header:
'accept': 'application/vnd.github.VERSION.raw'

swagger-codegen: errors with \d+ patterns and type: "array"

I'm a newbie to Swagger. I've used the swagger servlet to generate my swagger.json file from our REST API Java classes. The swagger.json file shows swagger 2.0 (I assume this is the 2.0 schema version). There was nothing fancy in the source files, just #Api and a few #ApiOperation annotations.
Then I tried using swagger-codegen-cli (both version 2.1.4 and 2.1.6-SNAPSHOT, the latest) to generate HTML output from the JSON file. I got the following results on both:
reading from dsm_swagger.json
[main] ERROR io.swagger.codegen.DefaultCodegen - unexpected missing property for name suppressed
[main] WARN io.swagger.codegen.DefaultCodegen - skipping invalid property {
"type" : "array"
}
writing file /home/combs/dsm_swagger/./index.html
So I get an output file, but any types that are flagged as lists of objects are not handled correctly. These do appear to be valid 2.0 constructs.
I'm also getting Jackson errors about invalid escape characters because it sees
"pattern": "\d+"
in the file. I can work around the \d by using [0-9], but assume it should be handled as is.
Has anybody seen these particular issues and know if they're either fixed or there is a workaround in swagger-codegen or the source file? Is swagger-codegen actually handling v2.0 specs correctly? Any pointers to up to date info or code would be appreciated!
EDIT:
As mentioned in a comment, by using "#JsonIgnore" and "#JsonProperty" in appropriate places and upgrading to V1.5.6 of swagger-core, I got around the issues with invalid property and type "array" messages. Here's an example of the issue with \d:
"/v1/admins/{adminId}": {
"put": {
"tags": [
"admins"
],
"summary": "Update information about a particular admin, given its ID. The update information is passed in the POST body.",
"description": "Longer notes about what this does",
"operationId": "updateUser",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "adminId",
"in": "path",
"required": true,
"type": "integer",
"pattern": "\d+",
"format": "int64"
},
{
"in": "body",
"name": "body",
"required": false,
"schema": {
"$ref": "#/definitions/UserUpdateInfo"
}
}
],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/UserInfo"
}
}
}
}
},
This is the exact output of swagger-core, and yet swagger-codegen fails with the following:
combs#dcombs-lap:~/dsm_swagger$ gen_file
reading from dsm_swagger.json
reading from dsm_swagger.json
com.fasterxml.jackson.core.JsonParseException: Unrecognized character escape 'd' (code 100)
at [Source: dsm_swagger.json; line: 411, column: 27]
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1419)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:508)
at com.fasterxml.jackson.core.base.ParserMinimalBase._handleUnrecognizedCharacterEscape(ParserMinimalBase.java:485)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._decodeEscaped(UTF8StreamJsonParser.java:2924)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishString2(UTF8StreamJsonParser.java:2209)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishString(UTF8StreamJsonParser.java:2165)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.getText(UTF8StreamJsonParser.java:279)
at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer.deserializeObject(JsonNodeDeserializer.java:224)
at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer.deserializeArray(JsonNodeDeserializer.java:262)
at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer.deserializeObject(JsonNodeDeserializer.java:221)
at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer.deserializeObject(JsonNodeDeserializer.java:218)
at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer.deserializeObject(JsonNodeDeserializer.java:218)
at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer.deserializeObject(JsonNodeDeserializer.java:218)
at com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:62)
at com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:14)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3066)
at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:1861)
at io.swagger.parser.SwaggerCompatConverter.readResourceListing(SwaggerCompatConverter.java:139)
at io.swagger.parser.SwaggerCompatConverter.read(SwaggerCompatConverter.java:74)
at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:73)
at io.swagger.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:317)
at io.swagger.codegen.cmd.Generate.run(Generate.java:186)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
Exception in thread "main" java.lang.RuntimeException: missing swagger input or config!
at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:89)
at io.swagger.codegen.cmd.Generate.run(Generate.java:188)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
combs#dcombs-lap:~/dsm_swagger$