Folder Reference for JSON Schema - json

I am trying to refer to schema located in a sub folder with $ref, I wanted to put as optional a couple of other schema files into my root schema file. I have seen about cross file reference and in file referencing with $ref, but wanted to check if an entire schema file/files can be referenced by folder. ie. for eg:
./subfolder/{...}.json
contains a list of schema files and in my root schema file i would like to reference them like
"$ref": "./subfolder/"
I am assuming, I could expand a schema file infinitely using a format like this. Thank for your answer and time.

It's better described as cross-resource referencing. JSON Schema has no notion of files or folders or file systems.
Instead, it does have the notion of URIs and URI resolution.
The approach you should take is to give each schema resource (contained in a JSON file), a full URI using $id. Then use full (or relative) references. You can use relative references if your URIs all use the same first parts (protocol and domain for example).
The implementation you're using should allow you to load in multiple schemas OR provide a means to resolve references using a user-defined function.
The usual approach is to load in all schemas, and then allow the URI references to resolve based on an index of $id.
Once you've loaded a schema into an implementation, it won't know the file it originally came from (if any), and can only rely on the URIs provided in the schema itself. Your schemas may define URIs as if they were available at different paths, but ultimately you COULD store them all in the same folder regardless.

Related

Missing object properties in design metadata SQLite file

My model in Autodesk construction cloud contains several properties which I need to track. I have downloaded the sqlite file using fetch derivative download URL without any errors.
However when comparing export with what I see in ACC, or the Fetch all properties call, some properties are entirely missing. For instance, the fetch all properties call returns the 20 expected property values whereas only 3 of these values exist in the SQLite download. Any explanation why the SQLite file may be incomplete? There doesn't seem to any size restriction or filter in the call returning SQLite which may explain partial results.
It is expected that the design metadata returned via sqlite and via JSON may not be the same. For example, the metadata captured in the sqlite database use "instancing" where multiple design elements may inherit certain properties from another element (and the resolution of the inherited properties is left to whomever is reading this file). The JSON format on the other hand does not support any kind of inheritance, so properties are duplicated for each individual design element.

JSON Schema - How to define dependencies between properties located in different files?

I am working with JSON schema for a file, which keeps a set of variables we are using to define our configuration, which will be executed through Ansible. Importantly, we are using JSON schema to validate YAML files.
So far everything goes well. However, I have this challenge.
I have a file called common.yml and other called domain.yml. Inside domain.yml we have a property called domain_root, which depends on a property called common_dir, which is inside common.yml and I have not found any documentation on how to define a dependency when the property is in place, but in another file.
By the way, dependencies in the same file are working without issues.
"dependencies": {
"domain_home": ["domain_parent_dir", "domain_name"],
"domain_libraries":["domain_home"],
"logs_directory":["oracle_user", "domain_name"],
}
Please, if you have any clues, kindly help me.
Best regards,
RCC
You cannot. JSON Schema actually doesn't work with files at all. JSON Schema implementations may load a file to get to the JSON, but JSON Schema knows nothing about files in a filesystem.
In stead, consider combining your multiple files into a single file for validation purposes.
This doesn't help if you want validation in-editor, but could help if you only need validation as part of a continuious intergration (CI) process.

How can I change the names of objects in a DWFx file?

I did a conversion program to change the object structure of a DWFx file, and it works fine. What I did was to open the DWFx file as a zip archive, parse the internal XML files, and reorganize them, creating new parent nodes when needed.
But what doesn't work is changing the names of these nodes. When I open the file in any Autodesk viewer (the offline Design Review program and the online Viewer are the ones I tested), the tree structure is changed as it should, but the parent node names are not. In fact, the nodes that already existed keep their old names, and the new ones are called Object XXXX. The child nodes (actual objects) have their names changed correctly.
I tried to search in every readable (text) file inside the DWFx, but none of them hold any other reference to these nodes. I didn't open binary files, like W3D files, which probably hold the geometry.
Does anyone have any experience in creating or altering DWFx files? Do I need to change anything else besides the 'label' tag in the Presentation XML file?
Instead of manipulating the contents of DWFx files manually, consider using one of the Autodesk Forge services: Design Automation. The APIs allow you to run AutoCAD "in the cloud". You could theoretically load your DWFx file there, update the structure/names, and generate an updated DWFx file. Here's an example of how the service can be used to generate PDFs out of DWG files: https://forge.autodesk.com/en/docs/design-automation/v2/tutorials/convert-dwg-to-pdf.

CATProduct fail to convert

CATProduct format files with multiple CATPart format files are assembly relationships, and upload files in CATProduct format will fail to convert. Is there any way to solve this problem? Such as CATProduct format files and multiple CATPart format files or specify the relationship between the subordinate relationship.
The way it usually works is that you either upload all the files in a zip and when translating you specify that it is a composite file and provide the rootFilename as well: http://adndevblog.typepad.com/cloud_and_mobile/2016/07/translate-referenced-files-by-derivative-api.html, or if you are uploading to A360/Fusion Team/BIM 360 Docs, then you could also upload each file separately and then define the relationships between them: http://adndevblog.typepad.com/cloud_and_mobile/2016/12/setting-up-references-between-files.html

Swagger API Specification filenames

I'm trying to use Swagger to create API documentation for an API we're building and I've never used it before.
The documentation on Github says that the Resources Listing needs t be at /api-docs and the various resource files need to be at /api-docs/books etc.
This makes naming files and folders very tricky. I think they expect the files to have no file names, rather than having a folder called /api-docs it has to be an extension-less file, then you can't put the resources in an api-docs folder because you can't call the folder that, so they suggest using a folder called /listings.
This folder doesn't appear in the URL structure of your documentation though, it's kind of invisible because you set the baseURL in your resources to the proper path, but it looks like that has to be an absolute path, which is awkward if you want to have it on several servers (local and production).
Maybe I just don't get it but this all seems to be absolutely nuts.
So, I have 2 questions.....
1) Can I give my resource listing file and my resource files a .json extension? This would make sense as it's a JSON file.
2) Can I use a relative path to the resource listing file in the baseURL in my resource files?
Ideally, my file structure would be flatter, like this...
/api-docs
resources.json
books.json
films.json
Is Swagger flexible enough to do this?
It's an IIS server if that makes any difference (if the solution requires routing for example).
I was able to put model files into a folder under the web root and could reference them like this.
$ref: '/models/model.yml#/MyObject'
Relative paths also worked without a leading slash.
$ref: 'models/model.yml#/MyObject'
Inside the model.yml, I can reference other objects int eh same file like this
$ref: '#/MyObject2'.
However, I could only get the main swagger file to import model files. I could not get one model file to cross-reference another model file.
I was using a Tomcat web server but the principle will be the same.