Skip to content

SCIMSchemaExtractor.Extract throws exception for schemas containing comments #903

@canea-asb

Description

@canea-asb

After upgrading SimpleIdServer from 6.0.2 to 6.0.3 and starting my SCIM server I got a System.Text.Json.JsonException thrown. The exception message said:

''/' is an invalid start of a property name. Expected a '"'. Path: $ | LineNumber: 11 | BytePositionInLine: 33.'

I looked in my schema files and noticed that I had a comment on a line in UserSchema.json. See the last line in the JSON below below:

{
  "id": "urn:ietf:params:scim:schemas:core:2.0:User",
  "name": "User",
  "description": "User Schema",
  "attributes": [
    {
      "name": "userName",
      "type": "string",
      "multiValued": false,
      "required": true,
      "caseExact": false,
      "mutability": "immutable", // lorem ipsum

After removing the comment and restarting the SCIM server I did not get this exception.

The exception was thrown on the last line in the code below:

public class SCIMSchemaExtractor
{
    public static SCIMSchema Extract(string filePath, string resourceType, bool isRootSchema = false)
    {
        var content = File.ReadAllText(filePath);
        var jObj = JsonSerializer.Deserialize<JsonObject>(content); // <----- exception here

It has worked before version 6.0.3.

Metadata

Metadata

Labels

bugSomething isn't working

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions