Problem with setting default argument in Typo3 routeEnhancer - yaml

I have a Typo3 page that works with two URL parameters, "manuscript" and "type" (e.g. localhost/my-page?manuscript=samplemanuscript&type=description). "manuscript" is a mandatory parameter, while "type" is optional.
I use Route Enhancers to get rid of cHash in the URL. So I have created a yaml file to configure it.
This configuration works fine without "defaults" section with both parameters in place, but when I add the defaults section to make "type" parameter optional, the URL localhost/my-page/samplemanuscript works fine, but localhost/my-page/samplemanuscript/description shows me the 404 error. Any ideas what's wrong with it?
I use Typo3 v10.4
routeEnhancers:
ManuscriptHierarchy:
type: Simple
limitToPages: [13]
routePath: '/{manuscript}/{type}'
defaults:
type: ''
aspects:
manuscript:
type: StaticValueMapper
map:
samplemanuscript: samplemanuscript
samplemanuscript2: samplemanuscript2
type:
type: StaticValueMapper
map:
transcription: transcription
description: description
P.S.
For debugging purposes, is there any appropriate way to check the final resolved URL (when I visit localhost/my-page/samplemanuscript/description)?

The solution looks strange to me but it works by adding requirements:
routeEnhancers:
ManuscriptHierarchy:
type: Simple
limitToPages: [13]
routePath: '/{manuscript}/{type}'
defaults:
type: ''
requirements:
manuscript: '^(?:samplemanuscript|samplemanuscript2)$'
type: '^(?:description|transcription)$'
aspects:
manuscript:
type: StaticValueMapper
map:
samplemanuscript: samplemanuscript
samplemanuscript2: samplemanuscript2
type:
type: StaticValueMapper
map:
transcription: transcription
description: description

Related

Create AWS::Pinpoint::PushTemplate using CF template

Hi I want to create AWS::Pinpoint::PushTemplate using cloudformation template and I am following this link: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-pinpoint-pushtemplate.html.
Type: AWS::Pinpoint::PushTemplate
Properties:
Default:
Action: OPEN_APP
Body: FirstName - {{firstName}}, LastName - {{lastName}}
Title: Title
DefaultSubstitutions:
firstName: default
lastName: default
Tags:
project: project
tashi: "Pinpoint Template"
TemplateName: template_name
I am getting type validation error for`DefaultSubstitutions: Property validation failure: [Value of property {/DefaultSubstitutions} does not match type {String}]
According to docs DefaultSubstitutions is a String.
However, in your case, you set it up as map:
DefaultSubstitutions:
firstName: default
lastName: default
Maybe have to try using it as json string:
DefaultSubstitutions: "{\"firstName"\:\"default\", \"lastName"\:\"default\"}"

#AO\JsonContent in parameter of get request

In swagger's documentation using OpenApi specification, you can wrap schema in parameter to content with application/json:
parameters:
- in: query
name: filter
# Wrap 'schema' into 'content.<media-type>'
content:
application/json: # <---- media type indicates how to serialize / deserialize the parameter content
schema:
type: object
properties:
type:
type: string
color:
type: string
to send objects like this filter={"type":"t-shirt","color":"blue"}.
How to do it in swagger-php?
The swagger-editor and swagger-ui have added support for http://swagger.io/docs/specification/describing-parameters
The swagger-php library has added support too, it will be part of the 3.0.4 release.

Delete navigation options from kibana

I wanted to know if we can remove options like "dev tools","monitering" etc from kibana page , localhost:5601. I want to have only Dashboard visualization options .
Nevermind, I found one way to do this by modifying src/core_plugins/kibana/index.js , deleting these blocks
{
id: 'kibana:dev_tools',
title: 'Dev Tools',
order: 9001,
url: '/app/kibana#/dev_tools',
description: 'development tools',
icon: 'plugins/kibana/assets/wrench.svg'
}, {
id: 'kibana:management',
title: 'Management',
order: 9003,
url: `${kbnBaseUrl}#/management`,
description: 'define index patterns, change config, and more',
icon: 'plugins/kibana/assets/settings.svg',
linkToLastSubUrl: false
}
and other blocks as per your need

How to reuse example from another definition in swagger?

I have a definition of a report object. I have another definition of reports object that has an array of report objects (via a $ref).
In the report definition, I have an example defined, which works fine in swagger UI.
In the reports definition, I want it to use the example from the report definition.
How can I do this? I've tried several things using $ref, the closest I got was what I have in the following YAML...
definitions:
report:
type: object
properties:
ID:
type: number
format: int
description: "DB record ID of the report."
readOnly: true
ErrorContent:
type: string
description: "The actual problem or error infomation for this report. This can be exception stack, etc."
readOnly: true
UserComments:
type: string
description: "Any user comments collected by the app and submitted with the report."
readOnly: true
ReportedBy:
type: string
description: "The person using the app when it triggered the error this report is for."
readOnly: true
ReportedDateTime:
type: string
description: "The date/time the report was submitted."
readOnly: true
required:
- ID
- ErrorContent
- ErrorType
- UserComments
- ReportedBy
- ReportedDateTime
example:
ID: 11367
ErrorContent: "Operation is not valid due to the current state of the object."
ErrorType: "Exception"
UserComments: "Was clicking this and that and then Boom!"
ReportedBy: "domain\\name"
ReportedDateTime: "2016-01-19 14:07:00"
reports:
properties:
message:
type: string
reports:
type: array
items:
$ref: '#/definitions/report'
example:
message: "success"
reports:
- $ref: '#/definitions/report'
However, in Swagger UI, the above results in...
{
"message": "success",
"reports": [
{
"$ref": "#/definitions/report"
}
]
}
One interesting note, in Swagger UI, when I look at the model view, it does have all of report even with descriptions.
This behavior is correct--the examples section cannot be referenced with a JSON pointer. See the OAI Specification for what is currently supported.
If you feel this is a common use case, please open an issue on the spec repository.

Uploading an avatar with symfony always null

I have been trying for like two days, everytime i upload an image, in the database i get null in avatar column and it's not even uploaded!
i'm using symfony 1.4 i have both sfdoctrineguard and sfforkeddoctrineapplyplugin (i think this is the problem because i remember when i first started the project before using it uploading worked)
i'm using the code in this tutorial :
http://blog.firehist.org/2010/02/21/symfony-upload-dimage-sans-dupliquer-les-fichiers/
i think i'm having the same problem as this guy :
http://oldforum.symfony-project.org/index.php/m/88206/
did anyone succeed uploading an avatar using sfforkedappluplugin ?
this is my user schema :
User:
inheritance:
type: column_aggregation
extends: sfGuardUserProfile
columns:
sexe:
type: string(1)
notnull: true
birthday:
type: timestamp
photo:
type: string(255)
thumbnail:
type: string(255)
mobile:
type: string(50)
notnull: true
unique: true
address:
type: string(255)
notnull: true
ip_inscription:
type: string(32)
is_online:
type: boolean
default: 0
status:
type: string(255)
aboutme:
type: string(255)
my avatar attribute is photo!
so any ideas how to fix this ?
btw i tried the normal jobeet 1.4 tutorial for uploading using the simple sfwidgetforminputfile and it didn't work :(
also the i made my photos folder 777 and i made www-data its owner!
i may have found the solution but i'm not sure i still need your opinions!
either add the column photo to the table sfGuardUser and them embed a form with juste the photo in my registerform
or create new table photo with relation 1 to 1 with sfGuardUser and also embed it in my register but this will engender some extra queries i think! and here too i have absolutely no idea how i can do that some hints or links may help me alot here!
thx in advance!

Resources