How to use $ref to reference a path from another OpenAPI file? - openapi

Here it says I could refer to the definition in another file for an individual path, but the example seems to refer to a whole file, instead of a single path definition under the paths object. How to assign an individual path in another file's paths object?
For example, I have Anotherfile.yaml that contains the /a/b path:
paths:
/a/b:
post:
In another file, I use $ref to reference the /a/b path as follows:
paths:
/c/d:
$ref: 'Anotherfile.yaml#/paths/a/b'
but this gives an error:
Could not find paths/a/b in contents of ./Anotherfile.yaml

When referencing paths, you need to escape the path name by replacing / with ~1, so that /a/b becomes ~1a~1b. Note that you escape just the path name and not the #/paths/ prefix.
$ref: 'Anotherfile.yaml#/paths/~1a~1b'

Related

Verify that the parameter value is from a specific location

In our team there are multiple applications.
In each application's code repository we have a pipeline.yml file that uses/extends the template common-pipeline.yml
pipeline.yml file passes parameter values to common-pipeline.yml using parameters section:
extends:
template: common-pipeline.yml#common-pipeline-repo
parameters:
appName: 'application-name'
enableTests: false
# the parameter value should not be directly configurable from this file but should come from specific relative folder
in common-pipeline.yml the parameter value is accessed:
parameters:
- name: enableTests
type: boolean
default: true
#I need the parameter value to come from specific relative path
Is it possible to add some condition in common-pipeline.yml to make sure that the enableTests parameter value comes from a specific location in the code repository?
Currently any developer can change the enableTests parameter value. We want to add some config file in each application's code repository and give edit rights to this subfolder to only few people in the team.
So in common-pipeline.yml can I verify that the enableTests parameter value is coming from a specific relative path like /pipeline/testconfig file?

How do I reference a relative path in Jupyter-book

In Jupyter-book, I am creating a _toc.yml file. I have something like -
- caption: Tutorials
chapters:
- file: ../../notebooks/some_notebook
I get the exception -
home/code/nwb_datajoint/docs/web-doc/intro.md:: WARNING: toctree contains reference to nonexisting document '../../notebooks/some_notebook' [etoc.ref]
looking for now-outdated files... none found
How do I reference a relative directory in in _toc.yml's parent directory?

Replace values in multiple appsettings files stored in different artifacts during VSTS Release pipeline

I am trying to replace appsettings.json and e2e-appsettings.json variables stored in two different artifacts in the release pipeline.
As per below code, ONLY appsettings.json is updating, but for the second line it gives an error,
error: NO JSON file matched with specific pattern: e2e/XXX.EndToEnd.Integration.Tests/e2e-appsettings.json
As per the information it should be the relative path to root. So in this case not sure what should be the root as there are two build artifacts.
Further in download artifact logs says,
2019-04-09T02:33:55.9132583Z Downloaded e2e/XXX.EndToEnd.Integration.Tests/e2e-appsettings.json to D:\a\r1\a\EstimationCore\e2e\XXX.EndToEnd.Integration.Tests\e2e-appsettings.json
The artifact with other appsettings.json file which is working fine is a zip file. logs, Downloading app/app.zip to D:\a\r1\a\EstimationCore\app\app.zip
These I have already tried which gave the same error
- NO JSON file matched with specific pattern: e2e/XXX.EndToEnd.Integration.Tests/e2e-appsettings.json.
- NO JSON file matched with specific pattern: **/*e2e-appsettings.json
- NO JSON file matched with specific pattern: d:\a\r1\a\EstimationCore\e2e\XXX.EndToEnd.Integration.Tests\e2e-appsettings.json.
- NO JSON file matched with specific pattern: d:\a\r1\a\EstimationCore\**\**\e2e-appsettings.json.

Duplicate N-times Sling resouce

I have a sling JCR resource tree, there is resource folder named test and file named testFile inside. testFile have own structure(subnodes/files) inside, I want copy all of them(with subnodes)
/root
|_test
|_testFile
For server test I want to make copy N-times of this file. Any idea how to do it using ResourceResolver ?
I need to have as below:
/root
|_test
|_testFile
|_testFile1
...
|_testFileN
You can write your own utility that does that and use the copy() method of the ResourceResolver, see the docs https://sling.apache.org/apidocs/sling11/org/apache/sling/api/resource/ResourceResolver.html#copy-java.lang.String-java.lang.String-

how can i get full repository path from SvnClient object?

is there a way to get full path of repository from an svn object?
when i use .path or .pathRepository method i get only relative path of the file
To get the the full uri to a file, use:
SvnInfoEventArgs info;
client.GetInfo(workingCopyPath, out info);
Console.WriteLine(info.Uri);
The repository root:
Console.WriteLine(info.RepositoryRoot);
SvnClient has a method GetRepositoryRoot which gives you the repository root URL. You can then combine this with the relative path of the file you get from .pathRepository.