Command "generate-types" is not defined - symfony

I'm trying to generate types from the schema.yaml file, which I created
schema.yaml
types:
product:
properties:
name: {nullable: false}
description: {nullable: false}
image: { range: "Text"}
Offer:
properties:
url: {nullable: false}
price: {nullable: false, range: "Number"}
priceCurrency: {nullable: false}
Then when I execute the following command
vendor/bin/schema generate-types src/ config/schema.yaml
I will receive the following error:
Command "generate-types" is not defined
I tried to know what is the reason but I couldn't find it out.
Where can I defined the command: generate-types
My smfony version is 5.3
thanks a lot

See this changelog:
The generate-types command has been renamed generate
You need to change generate-types to generate.

Related

Why does OpenApi generator name the class of service Api as "DefaultService" in Angular13

I add OpenApi Generator in my angular project, but when i generate the Api with the command " openapi-generator-cli generate -i ../openApi/src/main/resources/api.yml -g typescript-angular -o src/app/core/api/v1", the name of Api service generted is default.service.ts, how can I change the name generated ?
api.yml :
openapi: 3.0.3
info:
title: Test
description:
version: 1.0.0
servers:
- url: /api
paths:
/tests:
$ref: './controllers/test.yml#/tests'
test.yml
tests:
get:
operationId: loadTests
responses:
'200':
description:
content:
application/json:
schema:
type: array
items:
$ref: '../model/test.yml#/b'
script added to package.json :
"generate:api": "openapi-generator-cli generate -i ../openApi/src/main/resources/api.yml -g typescript-angular -o src/app/core/api/v1"
version of openApi :
"#openapitools/openapi-generator-cli": "^2.4.26",
image of files
You can achieve this using tags in your operation object.
tests:
get:
tags:
- testtag
operationId: loadTests
responses:
'200':
description:
...
In the above example, you'd get testtag.service.ts. It is allowed to specify more than one tag - but be aware: for each tag there will be one .service.ts-file. You can but don't have to introduce these tags separately to add a description.
All paths that have no tag will end up in the default.service.ts-file.
To learn more about tags and operations, you should have a look at the operation object chapter and/or the tag object chapter of the specification

How to specify a similiarities options checker of pylint in pre-commit args?

I've been trying to configure my pre-commit config file to ignore similiarities on imports and docstrings as described in: https://pylint.pycqa.org/en/latest/technical_reference/features.html?highlight=similar#similarities-checker-options
But I don't use any of .pylintrc files, just the .pre-commit-config.yaml.
Below is a snippet from .pre-commit-config.yaml
- id: pylint
name: pylint
entry: pylint
language: python
require_serial: true
types_or: [python, pyi]
exclude: 'kedro-init'
args: ['--disable=E0401,E1101,E1102,R0913,R0914,W0703,E0602,C0103,C0114,
W0102,C0330,C0326,W0107,R1716,R0902,E0611,E1124', '--fail-under=7.5',
'--ignore-imports=yes', '--ignore-docstrings=yes'] #this last line does not work
Is there any way to specify those options on the args key?
Thx!
python version: 3.8.x
pylint version: 2.12.3
If you retype your args in .pre-commit-config.yaml as below, it should work.
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: python
require_serial: true
types_or: [python, pyi]
exclude: 'kedro-init'
args: ["--ignore=E0401,E1101,E1102,R0913,R0914,W0703,E0602,C0103,
C0114, W0102,C0330,C0326,W0107,R1716,R0902,E0611,E1124",
"--fail-under=7.5"]

The task includes an option with an undefined variable. The error was: 'ansible.utils.unsafe_proxy.AnsibleUnsafeText object' has no attribute 'data'\n

I have simple playbook where fetching some data from Vault server using curl.
tasks:
- name: role_id
shell: 'curl \
--header "X-Vault-Token: s.ddDblh8DpHkOu3IMGbwrM6Je" \
--cacert vault-ssl-cert.chained \
https://active.vault.service.consul:8200/v1/auth/approle/role/cpanel/role-id'
register: 'vault_role_id'
- name: test1
debug:
msg: "{{ vault_role_id.stdout }}"
The output is like this:
TASK [test1] *********************************************************************************************************************************************************************
ok: [localhost] => {
"msg": {
"auth": null,
"data": {
"role_id": "65d02c93-689c-eab1-31ca-9efb1c3e090e"
},
"lease_duration": 0,
"lease_id": "",
"renewable": false,
"request_id": "8bc03205-dcc2-e388-57ff-cdcaef84ef69",
"warnings": null,
"wrap_info": null
}
}
Everything is ok if I am accessing first level attribute, like .stdout in previous example. I need deeper level attribute to reach, like vault_role_id.stdout.data.role_id. When I try this it is failing with following error:
"The task includes an option with an undefined variable. The error was: 'ansible.utils.unsafe_proxy.AnsibleUnsafeText object' has no attribute 'data'\n\n
Do you have suggestion what I can do to get properly attribute values from deeper level in this object hierarchy?
"The task includes an option with an undefined variable. The error was: 'ansible.utils.unsafe_proxy.AnsibleUnsafeText object' has no attribute 'data'\n\n
Yes, because what's happening is that rendering it into msg: with {{ is coercing the JSON text into a python dict; if you do want it to be a dict, then use either msg: "{{ (vault_role_id.stdout | from_json).data.role_id }}" or you can use set_fact: {vault_role_data: "{{vault_role_id.stdout}}"} and then vault_role_data will be a dict for the same reason it was coerced by your msg
You can see the opposite process by prefixing the msg with any characters:
- name: this one is text
debug:
msg: vault_role_id is {{ vault_role_id.stdout }}
- name: this one is coerced
debug:
msg: '{{ vault_role_id.stdout }}'
while this isn't what you asked, you should also add --fail to your curl so it exists with a non-zero return code if the request returns non-200-OK, or you can use the more ansible-y way via - uri: and set the return_content: yes parameter

Not able to execute lifecycle operation using script plugin

I'm trying to learn how to use script plugin. I'm following script plugin docs here but not able to make it work.
I've tried to use the plugin in two ways. The first, when cloudify.interface.lifecycle.start operation is mapped directly to a script:
tosca_definitions_version: cloudify_dsl_1_3
imports:
- 'http://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml'
node_templates:
Import_Project:
type: cloudify.nodes.WebServer
capabilities:
scalable:
properties:
default_instances: 1
interfaces:
cloudify.interfaces.lifecycle:
start:
implementation: scripts/create_project.sh
inputs: {}
The second with a direct mapping:
tosca_definitions_version: cloudify_dsl_1_3
imports:
- 'http://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml'
node_templates:
Import_Project:
type: cloudify.nodes.WebServer
capabilities:
scalable:
properties:
default_instances: 1
interfaces:
cloudify.interfaces.lifecycle:
start:
implementation: script.script_runner.tasks.run
inputs:
script_path: scripts/create_project.sh
I've created a directory named scripts and placed the below create_project.sh script in this directory:
#! /bin/bash -e
ctx logger info "Hello to this world"
hostname
I'm getting errors while validating the blueprint.
Error when operation is mapped directly to a script:
[2019-04-13 13:29:40.594] [DEBUG] DslParserExecClient - got output from dsl parser Could not extract plugin from operation mapping 'scripts/create_project.sh', which is declared for operation 'start'. In interface 'cloudify.interfaces.lifecycle' in node 'Import_Project' of type 'cloudify.nodes.WebServer'
in: /opt/cloudify-composer/backend/dev/workspace/2/tmp-27O0e1t813N6as
in line: 3, column: 2
path: node_templates.Import_Project
value: {'interfaces': {'cloudify.interfaces.lifecycle': {'start': {'implementation': 'scripts/create_project.sh', 'inputs': {}}}}, 'type': 'cloudify.nodes.WebServer', 'capabilities': {'scalable': {'properties': {'default_instances': 1}}}}
Error when using a direct mapping:
[2019-04-13 13:25:21.015] [DEBUG] DslParserExecClient - got output from dsl parser node 'Import_Project' has no relationship which makes it contained within a host and it has a plugin 'script' with 'host_agent' as an executor. These types of plugins must be installed on a host
in: /opt/cloudify-composer/backend/dev/workspace/2/tmp-279QCz2CV3Y81L
in line: 2, column: 0
path: node_templates
value: {'Import_Project': {'interfaces': {'cloudify.interfaces.lifecycle': {'start': {'implementation': 'script.script_runner.tasks.run', 'inputs': {'script_path': 'scripts/create_project.sh'}}}}, 'type': 'cloudify.nodes.WebServer', 'capabilities': {'scalable': {'properties': {'default_instances': 1}}}}}
What is missing to make this work?
I also found the Cloudify Script Plugin examples from their documentation do not work: https://docs.cloudify.co/4.6/working_with/official_plugins/configuration/script/
However, I found I can make the examples work by adding an executor line in parallel with the implementation line to override the host_agent executor as follows:
tosca_definitions_version: cloudify_dsl_1_3
imports:
- 'http://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml'
node_templates:
Import_Project:
type: cloudify.nodes.WebServer
capabilities:
scalable:
properties:
default_instances: 1
interfaces:
cloudify.interfaces.lifecycle:
start:
implementation: scripts/create_project.sh
executor: central_deployment_agent
inputs: {}

Knp Snappy Bundle Options

I'm using KnpSnappyBundle for my Symfony project and I'm trying to define some options in my config file. However if I set, for example:
knp_snappy:
pdf:
enabled: true
binary: /usr/local/bin/wkhtmltopdf
options: [ 'no-outline' ]
I get an error:
The option '0' does not exist.
How do I define options for the bundle?
Well, that was kinda dumb of me. YAML to the answer:
knp_snappy:
pdf:
enabled: true
binary: /usr/local/bin/wkhtmltopdf
options:
no-outline: true
The answer is:
knp_snappy:
pdf:
enabled: true
binary: /path/to/wkhtmltopdf
options:
- { name: 'page-size', value: 'A4' }

Resources