It doesn’t look like the actual error message. There is no “ipv4” key in your shared compose, but others had similar error messages with “ipv4_address”
It is important to share the exact error messag and to make sure your indentation is exactly as you had in the original file even if the issue is not with the indentation.
It looks like you shared the top-level networks block and the networks block under the service, but it was not menitoned in your post.
By the way your second yaml contains ipv4_adress not ipv4_address. One “d” is missing.
So again: exact error message and the original compose file would help. You can delete lines that you don’t want to share, but keep the indentation and everything else.