Writing of Schema Struct to PDC working

This commit is contained in:
Fernando Garzon 2023-02-22 09:25:56 -08:00
parent e1169e061e
commit 4918ef433b

View file

@ -850,10 +850,10 @@ func (s *SmartContract) WriteSchemaToPDC(ctx contractapi.TransactionContextInter
}
type transientInput struct {
//JsonSchemaContent map[string]interface{} `json:"JsonSchemaContent"`
JsonSchemaContent string `json:"JsonSchemaContent"`
SchemaId string `json:"SchemaId"`
Project string `json:"Project`
JsonSchemaContent map[string]interface{} `json:"JsonSchemaContent"`
//JsonSchemaContent string `json:"JsonSchemaContent"`
SchemaId string `json:"SchemaId"`
Project string `json:"Project`
}
// So far, we've taken what's on the transient dictionary and unmarshal it into the transientInput Struct
@ -862,10 +862,11 @@ func (s *SmartContract) WriteSchemaToPDC(ctx contractapi.TransactionContextInter
if err != nil {
return fmt.Errorf("failed to unmarshal JSON: %v", err)
}
jsonFileContent, err := s.JsonReader(ctx, assetInput.JsonSchemaContent)
if err != nil {
return err
}
jsonFileContent := assetInput.JsonSchemaContent
//jsonFileContent, err := s.JsonReader(ctx, assetInput.JsonSchemaContent)
//if err != nil {
//return err
//}
// Check if Schema already exists
assetAsBytes, err := ctx.GetStub().GetPrivateData(PDC1, assetInput.SchemaId)
if err != nil {