Azure schema registry does not work if schema JSON contains newlines
See original GitHub issue- Package Name: @azure/schema-registry
- Package Version: 1.0.0-beta.1
- Operating system: OS X 11.2
- nodejs
- version: v14.15.4
- browser
- name/version:
- typescript
- version: 4.1.3
- Is the bug related to documentation in
- README.md
- source code documentation
- SDK API docs on https://docs.microsoft.com
Describe the bug
The azure schema registry does not function if the schema content
contains newlines
To Reproduce Steps to reproduce the behavior: 1.
await new SchemaRegistryClient(..., new DefaultAzureCredential()).getSchemaId({
group: 'test'
name: 'Test',
serializationType: 'avro',
content: '{\n' +
' "type": "record",\n' +
' "name": "Test",\n' +
' "fields": [{ "name": "X", "type": { "type": "string" } }]\n' +
'}\n'
})
// will always return rejected promise with schema not found
or
await new SchemaRegistryClient(..., new DefaultAzureCredential()).registerSchema({
group: 'test'
name: 'Test',
serializationType: 'avro',
content: '{\n' +
' "type": "record",\n' +
' "name": "Test",\n' +
' "fields": [{ "name": "X", "type": { "type": "string" } }]\n' +
'}\n'
})
// will throw error
// RestError: {"Code":400,"Detail":"Schema validation failed: Invalid character after parsing property name. Expected ':' but got: \". Path '', line 1, position 4.
Expected behavior
Schema newlines (and whitespace) should not affect the API, as long as it results in the equivalent JSON
At the very minimum, this should have some major warnings in the SDK docs and typings
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:13 (9 by maintainers)
Top Results From Across the Web
Schema Registry API Reference
To use a multi-line example as a copy-paste test of an API, remove the newlines before running it so as not to trigger...
Read more >Loading JSON data from Cloud Storage | BigQuery
You can load newline delimited JSON data from Cloud Storage into a new table ... BigQuery supports the JSON type even if schema...
Read more >Kafka Producer
Avro schema subject to look up or to register in Confluent Schema Registry. If the specified subject to look up has multiple schema...
Read more >from_json function | Databricks on AWS
To keep corrupt records, you can set a string type field named columnNameOfCorruptRecord in an user-defined schema. If a schema does not have...
Read more >Schema Registry integration
The following example statements show how to create streams and tables that have Avro-formatted data. If you want to use Protobuf- or JSON- ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dhoepelman Hi, @nguerrera fixed this issue and is scheduled to be part of the v1.0.0-beta.2 happening this month. For now, could you please try this alpha version?
Yep, something fixed this between 1.0.0-beta.1 and now! 😁
I’m fairly convinced it was https://github.com/Azure/azure-sdk-for-js/pull/11650. There had been some issues with the swagger and autorest around the body being a raw string. Also, there really hasn’t been any other interesting changes since beta 1.