Why YAML Schema (from JSON Schema) is returning $ref x in schema can not be resolved? - visual-studio-code

I have this schema file in ./types/index.yaml:
$schema: "https://json-schema.org/draft/2020-12/schema"
name: Types in YAML
definitions:
flow:
type: object
properties:
slug:
type: string
flow_list:
type: 'array'
items:
$ref: "#/definitions/flow"
And I have this "instance" YAML file, in contents/en.yaml:
# yaml-language-server: $schema=../types/index.yaml#definitions/flow_list
-
slug: '123'
I would expect it to allow me to create a list of objects with the slug property on it (to get started), but instead I am getting something like this (with the ...... filled in with the full absolute OS path):
$ref 'definitions/flow_list' in 'file:///...../types/index.yaml' can not be resolved.
I am using the RedHat VSCode YAML extension. Any ideas on how to get it so I can write the array of "flows" here?

Restarting VSCode a few times seemed to fix it.

Related

openapi-generator and "ignoring complex example on request body" message

I use the org.openapi.generator gradle plugin (version 6.2.1) and when I generate spring codes from my openapi.yml file I have the follow message "Ignoring complex example on request body". I don't understand why, someone have an idea ?
Here is an exerpt of my openapi.yml file :
paths:
"/test":
post:
summary: ...
tags:
- ...
requestBody:
content:
application/json:
schema:
type: array
items:
$ref: ...
examples:
example1:
value: [
{
...
}
]
Thanks for your help
I don't find solution
The reason is that it is not implemented/supported yet: you cannot get rid of the warning (unless suppressing WARN logging).
The code generation still works and you can use the generated spring application.

How to use !ImportValue to get the resource arn using AWS SAM template

I have a base template, output section is like this:
Outputs:
layerName:
Value: !Ref Psycopg2LayerLambdaLayer
How to get the arn of Psycopg2LayerLambdaLayer using the output from the base template in my new template? is this correct?
Layers: !ImportValue layerName.arn
If you want to use an Output value as an Import in a different template, you must export it first. In your example, it might look like the following:
Outputs:
layerArn:
Value: !GetAtt Psycopg2LayerLambdaLayer.arn
Export:
Name: psycopg2LayerArn
After deploying this, you can import the value in another stack with !ImportValue psycopg2LayerArn.
Note that an export has to have a unique name per account and region, therefore it is a good idea to prefix it with the stack/resource name. Also note that you can’t export objects, only scalar values such as strings.
Read more at https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-importvalue.html

Getting values from a command in yaml parameter

When storing an array in the Azure pipeline yaml parameter, I normally declare the type object that looks something like this:
parameters:
- name: versions
type: object
default:
- 3.0.1
- 3.0.2
- 3.0.3
But now, the issue is I don't know this array set of versions and I have to get it from a command.
So I was thinking something like this:
parameters:
- name: versions
type: object
default: $npm view #get-versions
But it does not seem to work. Does anyone know how to get values from command for the parameter in yaml pipeline? I appreciate it so much!
You can't. Parameters need to be pre-defined and cannot be dynamically generated.
The ugly workaround would be to write an application that parses and updates the pipeline YAML when a new version of your package is published. An alternative is to just make the parameter value a free-form text field, with a reasonable default.

Is there any way to reference names within pubspec.yaml?

Is there any way to reference a predefined name in pubspec.yaml?
I am trying to reference the "name" key's value in a structure used by a plugin
name: tpoly
description: A new Flutter application.
# [...]
flutter_launcher_name:
name: *name
At the end the plugin should receive (basically the value should get substituted),
flutter_launcher_name:
name: tpoly
First declare the variable using &. Here, foo, for example:
name: &foo tpoly
To refer, use *.
flutter_launcher_name:
name: *foo

ELK6.6.1: new added fields in filebeat not passing to logstash or ElasticSearch

I added new field in filebeat.yml
as below:
filebeat.inputs:
# Each - is an input. Most options can be set at the input level, so
# you can use different inputs for various configurations.
# Below are the input specific configurations.
- type: log
# Change to true to enable this input configuration.
enabled: true
# Paths that should be crawled and fetched. Glob based paths.
paths:
- /home/kren/ELK/docker-elk/original-logs-000/testa/feedaggregator/*
tags: ["java"]
fields:
app_id: java
#fields_under_root: true
I could not see this new field in ES via Kibana and tried using it in logstash config and doesn't work
if [fields][app_type] == "java" or "%{[fields][app_type]}" == "java" {
grok {
match => {"message" =>"%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:Loglevel}%{SPACE}%{SPACE}%{GREEDYDATA:message}"}
overwrite => ["message"]
}
}
anyone could help please? how to test it?
Thanks
found problem.
app_id: "java"
need the double quote for the string value