Storing OpenAPI Specification Document in AWS DocumentDB

0

I am trying to store Open API Doc (Swagger Doc) in AWS DocumentDB which has following Json structure under path section of the doc.

It's failing to save the doc because of the periods in the key under "content", "application/vnd.hedtech.integration.v1.0.0+json". If I replace the periods with underscores it saves. I'm able to save in MongoDB without replacing periods in the key but not in AWS DocumentDB.

What's the best way to handle this?

Thanks,

"responses": {
    "200": {
        "description": "Success",
        "headers": {
            "X-Media-Type": {
                "description": "application/vnd.hedtech.integration.v6.1.0+json",
                "schema": {
                    "type": "string"
                }
            }
        },
        "content": {
            "application/vnd.hedtech.integration.v1.0.0+json": {
                "$ref": "#/components/schemas/api-name.json"
                }
            }
        }
    }
}
maharaj
질문됨 일 년 전206회 조회
1개 답변
1

AWS DocumentDB has certain restrictions that MongoDB does not, which can cause some issues when migrating data. One of these restrictions is that it does not allow field names to contain the dot character ('.'), which appears to be the problem you are encountering.

To handle this, there are a few options:

  • Replace the dots in the field names with another character: You mentioned that you have tried this and it works. While this is a possible solution, it may not be ideal if the field names are meaningful and used elsewhere.
  • Store the problematic data as a string: You could potentially store the entire block as a string. However, this would involve serializing and deserializing the data when you read and write it, and you would lose some of the benefits of using a document database.
  • Use a different database that supports field names with dots: If the use of dots in field names is a hard requirement, you may need to consider using a different database that supports this.
profile picture
전문가
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠