You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
panic: yaml: line 12: did not find expected key
goroutine 1 [running]:
main.main()
main.go:67 +0x70
Process finished with the exit code 2
It says there is an error on line number 12 ... which does not make sense given the input YAML.
package main
import (
"gopkg.in/yaml.v3"
)
varinputstring=`# Copyright 2024 Google LLC# Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at# http:#www.apache.org/licenses/LICENSE-2.0# Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.APIProxy: .revision: 1 .name: swagger-petstore-openapi-3-0 DisplayName: Swagger Petstore - OpenAPI 3.0 Description: |- This is a sample Pet Store Server based on the OpenAPI 3.0 specification. You can find out more about Swagger at [http://swagger.io](http://swagger.io). In the third iteration of the pet store, we've switched to the design first approach! You can now help us improve the API whether it's by making changes to the definition itself or to the code. That way, with time, we can improve the API in general, and expose some of the new features in OAS3. Some useful links: - [The Pet Store repository](https://github.com/swagger-api/swagger-petstore) - [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)Policies: # Copyright 2024 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http:#www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #- SpikeArrest: .continueOnError: false .enabled: true .name: Spike-Arrest-1 DisplayName: Spike Arrest Properties: {} Identifier: .ref: client.ip Rate: 100pm - OASValidation: .continueOnError: false .enabled: true .name: OAS-Validate DisplayName: OAS-Validate Source: request OASResource: oas://spec.yaml`funcmain() {
yamlNode:= yaml.Node{}
iferr:=yaml.Unmarshal([]byte(input), &yamlNode); err!=nil {
panic(err)
}
}
Other tools I've tried (like yamllint.com) correctly identify the error as being on line 47
The text was updated successfully, but these errors were encountered:
The program below outputs:
It says there is an error on line number 12 ... which does not make sense given the input YAML.
Other tools I've tried (like yamllint.com) correctly identify the error as being on line 47
The text was updated successfully, but these errors were encountered: